[OpenLayers-Trac] Re: [OpenLayers] #2959: instance of Array + GWT +
Buttons + IFRAME = BUG in Panel.js
OpenLayers
trac-20090302 at openlayers.org
Mon Dec 13 11:38:16 EST 2010
#2959: instance of Array + GWT + Buttons + IFRAME = BUG in Panel.js
-----------------------------------------------+----------------------------
Reporter: grigoryevigor | Owner:
Type: bug | Status: new
Priority: major | Milestone: 2.11 Release
Component: Control.Panel | Version: 2.10
Keywords: instanceof Array IFRAME GWT Panel | State:
-----------------------------------------------+----------------------------
Comment(by grigoryevigor):
Based on previous comment, I'm proposing to add this function to Util, and
use it to detect arrays:
/**
* Function: typeOf
* This function extends typeof operator and fixes it's missbehavior
* with arrays and null. Accepts arrays from foreign frames and windows.
* @see http://javascript.crockford.com/remedial.html
* @see http://perfectionkills.com/instanceof-considered-harmful-or-how-
to-write-a-robust-isarray/
*/
OpenLayers.Util.typeOf = function (value) {
var s = typeof value;
if (s === 'object') {
if (value) {
if (Object.prototype.toString.call(value) === '[object
Array]') {
s = 'array';
}
} else {
s = 'null';
}
}
return s;
};
--
Ticket URL: <http://trac.openlayers.org/ticket/2959#comment:4>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer
More information about the Trac
mailing list