More robust array type check. p=mwootendev, r=me (closes #2959)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12095 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-06-16 19:16:25 +00:00
parent 54cccc0783
commit 995d612caa
43 changed files with 97 additions and 59 deletions

View File

@@ -99,7 +99,7 @@ OpenLayers.Format.Atom = OpenLayers.Class(OpenLayers.Format.XML, {
*/
write: function(features) {
var doc;
if (features instanceof Array) {
if (OpenLayers.Util.isArray(features)) {
doc = this.createElementNSPlus("atom:feed");
doc.appendChild(
this.createElementNSPlus("atom:title", {
@@ -183,7 +183,7 @@ OpenLayers.Format.Atom = OpenLayers.Class(OpenLayers.Format.XML, {
// atom:author
if (atomAttrib.authors) {
var authors = atomAttrib.authors instanceof Array ?
var authors = OpenLayers.Util.isArray(atomAttrib.authors) ?
atomAttrib.authors : [atomAttrib.authors];
for (var i=0, ii=authors.length; i<ii; i++) {
entryNode.appendChild(
@@ -196,7 +196,7 @@ OpenLayers.Format.Atom = OpenLayers.Class(OpenLayers.Format.XML, {
// atom:category
if (atomAttrib.categories) {
var categories = atomAttrib.categories instanceof Array ?
var categories = OpenLayers.Util.isArray(atomAttrib.categories) ?
atomAttrib.categories : [atomAttrib.categories];
var category;
for (var i=0, ii=categories.length; i<ii; i++) {
@@ -220,7 +220,7 @@ OpenLayers.Format.Atom = OpenLayers.Class(OpenLayers.Format.XML, {
// atom:contributor
if (atomAttrib.contributors) {
var contributors = atomAttrib.contributors instanceof Array ?
var contributors = OpenLayers.Util.isArray(atomAttrib.contributors) ?
atomAttrib.contributors : [atomAttrib.contributors];
for (var i=0, ii=contributors.length; i<ii; i++) {
entryNode.appendChild(
@@ -243,7 +243,7 @@ OpenLayers.Format.Atom = OpenLayers.Class(OpenLayers.Format.XML, {
// atom:link
if (atomAttrib.links) {
var links = atomAttrib.links instanceof Array ?
var links = OpenLayers.Util.isArray(atomAttrib.links) ?
atomAttrib.links : [atomAttrib.links];
var link;
for (var i=0, ii=links.length; i<ii; i++) {