Permalink
Browse files

rename methods

  • Loading branch information...
1 parent b8d7206 commit bf83b37225d80174c6a931e51b6b315af79d9ae4 @fntz committed Oct 2, 2012
Showing with 14 additions and 13 deletions.
  1. +2 −1 src/prototype/dom/dom.js
  2. +9 −9 src/prototype/lang/hash.js
  3. +3 −3 test/unit/hash_test.js
View
@@ -685,7 +685,8 @@
for (var i = 0, node; node = nodes[i]; i++)
element.appendChild(node);
} else {
- element.innerHTML = content.stripScripts();
+ element.innerHTML = '';
+ element.appendChild(document.createTextNode(content.stripScripts()));
}
} else {
element.innerHTML = content.stripScripts();
View
@@ -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.
*
* ##### Example
*
* var hash = $H({England: 'London', Poland: 'Warsaw'});
*
- * h.each_key(function(country) {
+ * h.eachKey(function(country) {
* alert(country);
* });
* // Alerts: England
* // Alerts: Poland
*
**/
- function each_key(iterator, context) {
+ function eachKey(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.
*
* ##### Example
*
* var hash = $H({England: 'London', Poland: 'Warsaw'});
*
- * h.each_value(function(capital) {
+ * h.eachValue(function(capital) {
* alert(capital);
* });
* // Alerts: London
* // Alerts: Warsaw
**/
- function each_value(iterator, context) {
+ function eachValue(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.
*
* ##### Example
*
* 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);
* });
* //Alerts: London is the capital of England
* //Alerts: Warsaw is the capital of Poland
*
**/
- function each_pair(iterator, context) {
+ function eachPair(iterator, context) {
this.each(function(pair) {
iterator.call(context, pair.key, pair.value)
});
View
@@ -196,7 +196,7 @@ new Test.Unit.Runner({
testIterationWithEachKey: function() {
var hash = $H({a:1, b:2, c:3});
var keys = [];
- hash.each_key(function(key) {
+ hash.eachKey(function(key) {
keys.push(key);
});
this.assertEnumEqual(['a', 'b', 'c'], keys);
@@ -205,7 +205,7 @@ new Test.Unit.Runner({
testIterationWithEachValue: function() {
var hash = $H({a:1, b:2, c:3});
var values = [];
- hash.each_value(function(value) {
+ hash.eachValue(function(value) {
values.push(value);
});
this.assertEnumEqual([1, 2, 3], values);
@@ -215,7 +215,7 @@ new Test.Unit.Runner({
var hash = $H({a:1, b:2, c:3});
var keys = [];
var values = [];
- hash.each_pair(function(key, value) {
+ hash.eachPair(function(key, value) {
keys.push(key);
values.push(value);
});

0 comments on commit bf83b37

Please sign in to comment.