Loading ...
Sorry, an error occurred while loading the content.

Objects & iframes

Expand Messages
  • Christian Tiberg
    Hello! The following test if(oConfigs && (oConfigs.constructor == Object)) { in the constructor for YAHOO.widget.Column fails if the object has been created in
    Message 1 of 1 , Aug 18, 2008
    • 0 Attachment
      Hello!

      The following test

          if(oConfigs && (oConfigs.constructor == Object)) {
         
      in the constructor for YAHOO.widget.Column fails if the object has been created in another frame. Bug in FF3? Or something YUI should consider? I found this kind of text in several of the YUI files, so this might be why so many people are failing with iframes.

      Further tests revealed that an object created with the regular [] syntax in the iframe *ALSO* fails the test above, *DESPITE* identically created objects work outside an iframe. Stranger and stranger. I finally arrived at the following, which I call before passing the array to the DataTable constructor:

      function sanitize(arr)
      {
          for (var i=0; i<arr.length; i++)
              {
                  var obj = new Object; // var obj = [] DOESN'T WORK here
                  for (var s in arr[i])
                      obj[s] = arr[i][s];
                  arr[i] = obj;
              }
      }

      Btw, the YAHOO.lang.isObject code works in the iframe, so I'm left wondering why this isn't used throughout YUI?

      I haven't tried any of this in IE or other browsers, only in FF3, mainly because I've moved on to other things - if it works, don't fix it :)

      Best regards,
      Christian Tiberg
    Your message has been successfully submitted and would be delivered to recipients shortly.