Navigation Menu

Skip to content

Commit

Permalink
- use feature testing for additional enumeration in Joose.O.each
Browse files Browse the repository at this point in the history
  • Loading branch information
canonic-epicure committed Nov 8, 2011
1 parent de092a7 commit 4aa5518
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/Joose.js
Expand Up @@ -117,6 +117,13 @@ Joose.S = {

var baseFunc = function () {}

var enumProps = [ 'hasOwnProperty', 'valueOf', 'toString', 'constructor' ]

var manualEnum = true

for (var i in { toString : 1 }) manualEnum = false


// Static helpers for objects
Joose.O = {

Expand All @@ -126,8 +133,8 @@ Joose.O = {
for (var i in object)
if (func.call(scope, object[i], i) === false) return false

if (Joose.is_IE)
return Joose.A.each([ 'toString', 'constructor', 'hasOwnProperty' ], function (el) {
if (manualEnum)
return Joose.A.each(enumProps, function (el) {

if (object.hasOwnProperty(el)) return func.call(scope, object[el], el)
})
Expand Down

0 comments on commit 4aa5518

Please sign in to comment.