diff --git a/CHANGELOG b/CHANGELOG index 0ca90ad..768b98e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/src/dom.js b/src/dom.js index 49cc145..599c8ef 100644 --- a/src/dom.js +++ b/src/dom.js @@ -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) { diff --git a/src/selector.js b/src/selector.js index 6b4c8d9..3bc72a7 100644 --- a/src/selector.js +++ b/src/selector.js @@ -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()); }); diff --git a/src/string.js b/src/string.js index 30d0ffb..1fa396e 100644 --- a/src/string.js +++ b/src/string.js @@ -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) {