Skip to content

Commit

Permalink
rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fntz committed Oct 2, 2012
1 parent b8d7206 commit bf83b37
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/prototype/dom/dom.js
Expand Up @@ -685,7 +685,8 @@
for (var i = 0, node; node = nodes[i]; i++) for (var i = 0, node; node = nodes[i]; i++)
element.appendChild(node); element.appendChild(node);
} else { } else {
element.innerHTML = content.stripScripts(); element.innerHTML = '';
element.appendChild(document.createTextNode(content.stripScripts()));
} }
} else { } else {
element.innerHTML = content.stripScripts(); element.innerHTML = content.stripScripts();
Expand Down
18 changes: 9 additions & 9 deletions src/prototype/lang/hash.js
Expand Up @@ -105,61 +105,61 @@ var Hash = Class.create(Enumerable, (function() {
} }


/** /**
* Hash#each_key(iterator[, context]) -> Hash * Hash#eachKey(iterator[, context]) -> Hash
* *
* Iterates over the keys in the hash. * Iterates over the keys in the hash.
* *
* ##### Example * ##### Example
* *
* var hash = $H({England: 'London', Poland: 'Warsaw'}); * var hash = $H({England: 'London', Poland: 'Warsaw'});
* *
* h.each_key(function(country) { * h.eachKey(function(country) {
* alert(country); * alert(country);
* }); * });
* // Alerts: England * // Alerts: England
* // Alerts: Poland * // Alerts: Poland
* *
**/ **/
function each_key(iterator, context) { function eachKey(iterator, context) {
this.keys().each(iterator, context); this.keys().each(iterator, context);
} }


/** /**
* Hash#each_value(iterator[, context]) -> Hash * Hash#eachValue(iterator[, context]) -> Hash
* *
* Iterates over the values in the hash. * Iterates over the values in the hash.
* *
* ##### Example * ##### Example
* *
* var hash = $H({England: 'London', Poland: 'Warsaw'}); * var hash = $H({England: 'London', Poland: 'Warsaw'});
* *
* h.each_value(function(capital) { * h.eachValue(function(capital) {
* alert(capital); * alert(capital);
* }); * });
* // Alerts: London * // Alerts: London
* // Alerts: Warsaw * // Alerts: Warsaw
**/ **/
function each_value(iterator, context) { function eachValue(iterator, context) {
this.values().each(iterator, context); this.values().each(iterator, context);
} }


/** /**
* Hash#each_pair(iterator[, context]) -> Hash * Hash#eachPair(iterator[, context]) -> Hash
* *
* Iterates over the key/value pairs in the hash. * Iterates over the key/value pairs in the hash.
* *
* ##### Example * ##### Example
* *
* var hash = $H({England: 'London', Poland: 'Warsaw'}); * var hash = $H({England: 'London', Poland: 'Warsaw'});
* *
* h.each_pair(function(country, capital) { * h.eachPair(function(country, capital) {
* alert(capital + "is the capital of " + country); * alert(capital + "is the capital of " + country);
* }); * });
* //Alerts: London is the capital of England * //Alerts: London is the capital of England
* //Alerts: Warsaw is the capital of Poland * //Alerts: Warsaw is the capital of Poland
* *
**/ **/
function each_pair(iterator, context) { function eachPair(iterator, context) {
this.each(function(pair) { this.each(function(pair) {
iterator.call(context, pair.key, pair.value) iterator.call(context, pair.key, pair.value)
}); });
Expand Down
6 changes: 3 additions & 3 deletions test/unit/hash_test.js
Expand Up @@ -196,7 +196,7 @@ new Test.Unit.Runner({
testIterationWithEachKey: function() { testIterationWithEachKey: function() {
var hash = $H({a:1, b:2, c:3}); var hash = $H({a:1, b:2, c:3});
var keys = []; var keys = [];
hash.each_key(function(key) { hash.eachKey(function(key) {
keys.push(key); keys.push(key);
}); });
this.assertEnumEqual(['a', 'b', 'c'], keys); this.assertEnumEqual(['a', 'b', 'c'], keys);
Expand All @@ -205,7 +205,7 @@ new Test.Unit.Runner({
testIterationWithEachValue: function() { testIterationWithEachValue: function() {
var hash = $H({a:1, b:2, c:3}); var hash = $H({a:1, b:2, c:3});
var values = []; var values = [];
hash.each_value(function(value) { hash.eachValue(function(value) {
values.push(value); values.push(value);
}); });
this.assertEnumEqual([1, 2, 3], values); this.assertEnumEqual([1, 2, 3], values);
Expand All @@ -215,7 +215,7 @@ new Test.Unit.Runner({
var hash = $H({a:1, b:2, c:3}); var hash = $H({a:1, b:2, c:3});
var keys = []; var keys = [];
var values = []; var values = [];
hash.each_pair(function(key, value) { hash.eachPair(function(key, value) {
keys.push(key); keys.push(key);
values.push(value); values.push(value);
}); });
Expand Down

0 comments on commit bf83b37

Please sign in to comment.