sdk/src/third-party/easyXDM/easyXDM.js
function createFrame(config){
    if (undef(HAS_NAME_PROPERTY_BUG)) {
        testForNamePropertyBug();
    }
    var frame;
    // This is to work around the problems in IE6/7 with setting the name property. 
    // Internally this is set as 'submitName' instead when using 'iframe.name = ...'
    // This is not required by easyXDM itself, but is to facilitate other use cases 
    if (HAS_NAME_PROPERTY_BUG) {
        frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>");
    }
    else {
        frame = document.createElement("IFRAME");
        frame.name = config.props.name;
    }
    
    frame.id = frame.name = config.props.name;
    delete config.props.name;
    
    if (typeof config.container == "string") {
        config.container = document.getElementById(config.container);
    }
    
    if (!config.container) {
        // This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers.
        apply(frame.style, {
            position: "absolute",
            top: "-2000px",
            // Avoid potential horizontal scrollbar
            left: "0px"
        });
        config.container = document.body;
    }
    
    // HACK: IE cannot have the src attribute set when the frame is appended
    //       into the container, so we set it to "javascript:false" as a
    //       placeholder for now.  If we left the src undefined, it would
    //       instead default to "about:blank", which causes SSL mixed-content
    //       warnings in IE6 when on an SSL parent page.
    var src = config.props.src;
    config.props.src = "javascript:false";
    
    // transfer properties to the frame
    apply(frame, config.props);
    
    frame.border = frame.frameBorder = 0;
    frame.allowTransparency = true;
    config.container.appendChild(frame);
    
    if (config.onLoad) {
        on(frame, "load", config.onLoad);
    }
    
    // set the frame URL to the proper value (we previously set it to
    // "javascript:false" to work around the IE issue mentioned above)
    if(config.usePost) {
        var form = config.container.appendChild(document.createElement('form')), input;
        form.target = frame.name;
        form.action = src;
        form.method = 'POST';
        if (typeof(config.usePost) === 'object') {
            for (var i in config.usePost) {
                if (config.usePost.hasOwnProperty(i)) {
                    if (HAS_NAME_PROPERTY_BUG) {
                        input = document.createElement('<input name="' + i + '"/>');
                    } else {
                        input = document.createElement("INPUT");
                        input.name = i;
                    }
                    input.value = config.usePost[i];
                    form.appendChild(input);
                }
            }
        }
        form.submit();
        form.parentNode.removeChild(form);
    } else {
        frame.src = src;
    }
    config.props.src = src;
    
    return frame;
}
function createFrame(config){
    if (undef(HAS_NAME_PROPERTY_BUG)) {
        testForNamePropertyBug();
    }
    var frame;
    // This is to work around the problems in IE6/7 with setting the name property. 
    // Internally this is set as 'submitName' instead when using 'iframe.name = ...'
    // This is not required by easyXDM itself, but is to facilitate other use cases 
    if (HAS_NAME_PROPERTY_BUG) {
        frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>");
    }
    else {
        frame = document.createElement("IFRAME");
        frame.name = config.props.name;
    }
    
    frame.id = frame.name = config.props.name;
    delete config.props.name;
    
    if (typeof config.container == "string") {
        config.container = document.getElementById(config.container);
    }
    
    if (!config.container) {
        // This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers.
        apply(frame.style, {
            position: "absolute",
            top: "-2000px",
            // Avoid potential horizontal scrollbar
            left: "0px"
        });
        config.container = document.body;
    }
    
    // HACK: IE cannot have the src attribute set when the frame is appended
    //       into the container, so we set it to "javascript:false" as a
    //       placeholder for now.  If we left the src undefined, it would
    //       instead default to "about:blank", which causes SSL mixed-content
    //       warnings in IE6 when on an SSL parent page.
    var src = config.props.src;
    config.props.src = "javascript:false";
    
    // transfer properties to the frame
    apply(frame, config.props);
    
    frame.border = frame.frameBorder = 0;
    frame.allowTransparency = true;
    config.container.appendChild(frame);
    
    if (config.onLoad) {
        on(frame, "load", config.onLoad);
    }
    
    // set the frame URL to the proper value (we previously set it to
    // "javascript:false" to work around the IE issue mentioned above)
    if(config.usePost) {
        var form = config.container.appendChild(document.createElement('form')), input;
        form.target = frame.name;
        form.action = src;
        form.method = 'POST';
        if (typeof(config.usePost) === 'object') {
            for (var i in config.usePost) {
                if (config.usePost.hasOwnProperty(i)) {
                    if (HAS_NAME_PROPERTY_BUG) {
                        input = document.createElement('<input name="' + i + '"/>');
                    } else {
                        input = document.createElement("INPUT");
                        input.name = i;
                    }
                    input.value = config.usePost[i];
                    form.appendChild(input);
                }
            }
        }
        form.submit();
        form.parentNode.removeChild(form);
    } else {
        frame.src = src;
    }
    config.props.src = src;
    
    return frame;
}
function createFrame ( config ) { if ( undef ( HAS_NAME_PROPERTY_BUG ) ) { testForNamePropertyBug ( ) ; } var frame ; // This is to work around the problems in IE6/7 with setting the name property.  // Internally this is set as 'submitName' instead when using 'iframe.name = ...' // This is not required by easyXDM itself, but is to facilitate other use cases  if ( HAS_NAME_PROPERTY_BUG ) { frame = document . createElement ( "<iframe name=\"" + config . props . name + "\"/>" ) ; } else { frame = document . createElement ( "IFRAME" ) ; frame . name = config . props . name ; } frame . id = frame . name = config . props . name ; delete config . props . name ; if ( typeof config . container == "string" ) { config . container = document . getElementById ( config . container ) ; } if ( ! config . container ) { // This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers. apply ( frame . style , { position : "absolute" , top : "-2000px" , // Avoid potential horizontal scrollbar left : "0px" } ) ; config . container = document . body ; } // HACK: IE cannot have the src attribute set when the frame is appended //       into the container, so we set it to "javascript:false" as a //       placeholder for now.  If we left the src undefined, it would //       instead default to "about:blank", which causes SSL mixed-content //       warnings in IE6 when on an SSL parent page. var src = config . props . src ; config . props . src = "javascript:false" ; // transfer properties to the frame apply ( frame , config . props ) ; frame . border = frame . frameBorder = 0 ; frame . allowTransparency = true ; config . container . appendChild ( frame ) ; if ( config . onLoad ) { on ( frame , "load" , config . onLoad ) ; } // set the frame URL to the proper value (we previously set it to // "javascript:false" to work around the IE issue mentioned above) if ( config . usePost ) { var form = config . container . appendChild ( document . createElement ( 'form' ) ) , input ; form . target = frame . name ; form . action = src ; form . method = 'POST' ; if ( typeof ( config . usePost ) === 'object' ) { for ( var i in config . usePost ) { if ( config . usePost . hasOwnProperty ( i ) ) { if ( HAS_NAME_PROPERTY_BUG ) { input = document . createElement ( '<input name="' + i + '"/>' ) ; } else { input = document . createElement ( "INPUT" ) ; input . name = i ; } input . value = config . usePost [ i ] ; form . appendChild ( input ) ; } } } form . submit ( ) ; form . parentNode . removeChild ( form ) ; } else { frame . src = src ; } config . props . src = src ; return frame ; }
Creates a frame and appends it to the DOM.
@param config {object} This object can have the following properties
<ul>
<li> {object} prop The properties that should be set on the frame. This should include the 'src' property.</li>
<li> {object} attr The attributes that should be set on the frame.</li>
<li> {DOMElement} container Its parent element (Optional).</li>
<li> {function} onLoad A method that should be called with the frames contentWindow as argument when the frame is fully loaded. (Optional)</li>
</ul>
@return The frames DOMElement
@type DOMElement
Creates a frame and appends it to the DOM .