prototype: Don't redeclare previously declared variables. Closes #10007

This commit is contained in:
Tobie Langel 2007-11-15 22:15:24 +00:00
parent 07a16464e8
commit d20cc77e0c
4 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,5 @@
* Don't redeclare previously declared variables. Closes #10007 [kuriyama]
* For consistency: use Object.isUndefined where possible. [Tobie Langel]
* Make String#isJSON return false for empty or blank strings. Make Ajax.Response#responseJSON null when Ajax.Response#responseText is empty or blank. [Andrew Dupont, Thomas Fuchs, Tobie Langel]

View File

@ -289,7 +289,8 @@ Element.Methods = {
else attributes[name] = Object.isUndefined(value) ? true : value;
for (var attr in attributes) {
var name = t.names[attr] || attr, value = attributes[attr];
name = t.names[attr] || attr;
value = attributes[attr];
if (t.values[attr]) name = t.values[attr](element, value);
if (value === false || value === null)
element.removeAttribute(name);
@ -792,7 +793,7 @@ else if (Prototype.Browser.IE) {
return node ? node.value : "";
},
_getEv: function(element, attribute) {
var attribute = element.getAttribute(attribute);
attribute = element.getAttribute(attribute);
return attribute ? attribute.toString().slice(23, -2) : null;
},
_flag: function(element, attribute) {

View File

@ -163,7 +163,7 @@ Object.extend(Selector, {
'enabled': "[not(@disabled)]",
'not': function(m) {
var e = m[6], p = Selector.patterns,
x = Selector.xpath, le, m, v;
x = Selector.xpath, le, v;
var exclusion = [];
while (e && le != e && (/\S/).test(e)) {
@ -612,7 +612,8 @@ Object.extend(Selector, {
},
findChildElements: function(element, expressions) {
var exprs = expressions.join(','), expressions = [];
var exprs = expressions.join(',');
expressions = [];
exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
expressions.push(m[1].strip());
});

View File

@ -247,7 +247,8 @@ var Template = Class.create({
if (before == '\\') return match[2];
var ctx = object, expr = match[3];
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
match = pattern.exec(expr);
if (match == null) return before;
while (match != null) {