Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changed the way of checking for the method to apply, using Arian style

added flatten to the list of the method to fix
removed useless always-true checking 
using short-circuit to avoid looking for all the elements if not on map
changed coding standard to adhere to mootools standards (i hope so :P)
  • Loading branch information...
commit 96f7bfd925474ea24a5c8b97b3fc80a240df297a 1 parent 6567fa2
@kentaromiura authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 Source/Element/Element.js
View
6 Source/Element/Element.js
@@ -200,10 +200,12 @@ if (object[1] == 1) Elements.implement('splice', function(){
Array.forEachMethod(function(method, name){
var wrap;
- if(name in {map:1,splice:1,slice:1,clone:1}){
+ if (({map: 1, splice: 1, slice: 1, clone: 1, flatten: 1})[name]){
wrap = function(){
var result = method.apply(this, arguments);
- if(typeOf(result) == 'array' && result.every(function(el){return typeOf(el) == 'element';})){
+ if (name != 'map' || result.every(function(el){
+ return typeOf(el) == 'element';
+ })){
result = new Elements(result);
}
return result;
Please sign in to comment.
Something went wrong with that request. Please try again.