abdolence / x2js

x2js - XML to JSON and back for JavaScript
1.01k stars 492 forks source link

Fails on values from other frame or iframe #31

Open liftarn opened 8 years ago

liftarn commented 8 years ago

The code uses a lot of instanceof and instanceof lies when a value comes from another frame or iframe. This means that jsonObj instanceof Object needs to be replaced with typeof(jsonObj) === 'object' or some other workaround. See http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/ for some ideas.