Permalink
Browse files

Merge remote-tracking branch 'origin/master'

Conflicts:
	release/edge/precompiled/minified/date.js
	release/edge/precompiled/minified/string.js
	release/edge/sugar-edge-full.min.js
	release/edge/sugar-edge.min.js
  • Loading branch information...
2 parents a79877d + a8b02a5 commit f56175b23e810139b8ef7fb135f6047cd7b862a6 @andrewplummer committed Oct 7, 2012
View
@@ -905,15 +905,8 @@
*
***/
'sample': function(num) {
- var result = [], arr = this.clone(), index;
- if(isUndefined(num)) num = 1;
- while(result.length < num) {
- index = floor(math.random() * (arr.length - 1));
- result.push(arr[index]);
- arr.removeAt(index);
- if(arr.length == 0) break;
- }
- return arguments.length > 0 ? result : result[0];
+ var arr = this.randomize();
+ return arguments.length > 0 ? arr.slice(0, num) : arr[0];
},
/***
View
@@ -92,8 +92,6 @@
}
}
-
-
extend(string, true, false, {
/***
@@ -152,7 +150,12 @@
*
***/
'escapeHTML': function() {
- return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+ return this.replace(/&/g, '&amp;' )
+ .replace(/</g, '&lt;' )
+ .replace(/>/g, '&gt;' )
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&apos;')
+ .replace(/\//g, '&#x2f;');
},
/***
@@ -166,7 +169,12 @@
*
***/
'unescapeHTML': function() {
- return this.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
+ return this.replace(/&amp;/g, '&')
+ .replace(/&lt;/g, '<')
+ .replace(/&gt;/g, '>')
+ .replace(/&quot;/g, '"')
+ .replace(/&apos;/g, "'")
+ .replace(/&#x2f;/g, '/');
},
/***
@@ -905,15 +905,8 @@
*
***/
'sample': function(num) {
- var result = [], arr = this.clone(), index;
- if(isUndefined(num)) num = 1;
- while(result.length < num) {
- index = floor(math.random() * (arr.length - 1));
- result.push(arr[index]);
- arr.removeAt(index);
- if(arr.length == 0) break;
- }
- return arguments.length > 0 ? result : result[0];
+ var arr = this.randomize();
+ return arguments.length > 0 ? arr.slice(0, num) : arr[0];
},
/***
@@ -92,8 +92,6 @@
}
}
-
-
extend(string, true, false, {
/***
@@ -152,7 +150,12 @@
*
***/
'escapeHTML': function() {
- return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+ return this.replace(/&/g, '&amp;' )
+ .replace(/</g, '&lt;' )
+ .replace(/>/g, '&gt;' )
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&apos;')
+ .replace(/\//g, '&#x2f;');
},
/***
@@ -166,7 +169,12 @@
*
***/
'unescapeHTML': function() {
- return this.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
+ return this.replace(/&amp;/g, '&')
+ .replace(/&lt;/g, '<')
+ .replace(/&gt;/g, '>')
+ .replace(/&quot;/g, '"')
+ .replace(/&apos;/g, "'")
+ .replace(/&#x2f;/g, '/');
},
/***
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit f56175b

Please sign in to comment.