javascript - calling Underscore js isEmpty on HTML object returns true in iOS8 -
can underscore js isempty function used on html object?
e.g.
_.isempty(document.getelementbyid('mydiv'));
this seems work fine desktop platforms , android devices returns true in ios although know should false.
is ok utilize on html object or should utilize method?
update:
this isempty function
// given array, string, or object empty? // "empty" object has no enumerable own-properties. _.isempty = function(obj) { if (obj == null) homecoming true; if (_.isarray(obj) || _.isstring(obj)) homecoming obj.length === 0; (var key in obj) if (_.has(obj, key)) homecoming false; homecoming true; };
and failing on _.has(obj, key) part is
_.has = function(obj, key) { console.log('hasownproperty: obj=',obj,'key=', key, ':', hasownproperty.call(obj, key)); homecoming hasownproperty.call(obj, key); }
for reason in ios8, calling hasownproperty on html object returns false.
e.g. output ios8
hasownproperty: obj= div#game-holder key= align : false
any ideas?
javascript underscore.js
No comments:
Post a Comment