src/courier/PostMessageChannel.js
function _createIFrame(options, container) {
            var frame = document.createElement("IFRAME");
            var name = PostMessageUtilities.createUniqueSequence(IFRAME_PREFIX + PostMessageUtilities.SEQUENCE_FORMAT);
            var delay = options.delayLoad;
            var defaultAttributes = {
                "id": name,
                "name" :name,
                "tabindex": "-1",       // To prevent it getting focus when tabbing through the page
                "aria-hidden": "true",  // To prevent it being picked up by screen-readers
                "title":  "",           // Adding an empty title for accessibility
                "role": "presentation", // Adding a presentation role http://yahoodevelopers.tumblr.com/post/59489724815/easy-fixes-to-common-accessibility-problems
                "allowTransparency":"true"
            };
            var defaultStyle = {
                width :"0px",
                height : "0px",
                position :"absolute",
                top : "-1000px",
                left : "-1000px"
            };

            options.attributes = options.attributes || defaultAttributes;
            for (var key in options.attributes){
                if (options.attributes.hasOwnProperty(key)) {
                    frame.setAttribute(key, options.attributes[key]);
                }
            }

            options.style = options.style || defaultStyle;
            if (options.style) {
                for (var attr in options.style) {
                    if (options.style.hasOwnProperty(attr)) {
                        frame.style[attr] = options.style[attr];
                    }
                }
            }

            // Append and hookup after body tag opens
            _waitForBody({
                delay: delay,
                onready: function() {
                    (container || document.body).appendChild(frame);
                    this.rmload = _addLoadHandler.call(this, frame);
                    _setIFrameLocation.call(this, frame, options.url, (false !== options.bust));
                }.bind(this)
            });

            return frame;
        }
function _createIFrame(options, container) {
            var frame = document.createElement("IFRAME");
            var name = PostMessageUtilities.createUniqueSequence(IFRAME_PREFIX + PostMessageUtilities.SEQUENCE_FORMAT);
            var delay = options.delayLoad;
            var defaultAttributes = {
                "id": name,
                "name" :name,
                "tabindex": "-1",       // To prevent it getting focus when tabbing through the page
                "aria-hidden": "true",  // To prevent it being picked up by screen-readers
                "title":  "",           // Adding an empty title for accessibility
                "role": "presentation", // Adding a presentation role http://yahoodevelopers.tumblr.com/post/59489724815/easy-fixes-to-common-accessibility-problems
                "allowTransparency":"true"
            };
            var defaultStyle = {
                width :"0px",
                height : "0px",
                position :"absolute",
                top : "-1000px",
                left : "-1000px"
            };

            options.attributes = options.attributes || defaultAttributes;
            for (var key in options.attributes){
                if (options.attributes.hasOwnProperty(key)) {
                    frame.setAttribute(key, options.attributes[key]);
                }
            }

            options.style = options.style || defaultStyle;
            if (options.style) {
                for (var attr in options.style) {
                    if (options.style.hasOwnProperty(attr)) {
                        frame.style[attr] = options.style[attr];
                    }
                }
            }

            // Append and hookup after body tag opens
            _waitForBody({
                delay: delay,
                onready: function() {
                    (container || document.body).appendChild(frame);
                    this.rmload = _addLoadHandler.call(this, frame);
                    _setIFrameLocation.call(this, frame, options.url, (false !== options.bust));
                }.bind(this)
            });

            return frame;
        }
function _createIFrame ( options , container ) { var frame = document . createElement ( "IFRAME" ) ; var name = PostMessageUtilities . createUniqueSequence ( IFRAME_PREFIX + PostMessageUtilities . SEQUENCE_FORMAT ) ; var delay = options . delayLoad ; var defaultAttributes = { "id" : name , "name" : name , "tabindex" : "-1" , // To prevent it getting focus when tabbing through the page "aria-hidden" : "true" , // To prevent it being picked up by screen-readers "title" : "" , // Adding an empty title for accessibility "role" : "presentation" , // Adding a presentation role http://yahoodevelopers.tumblr.com/post/59489724815/easy-fixes-to-common-accessibility-problems "allowTransparency" : "true" } ; var defaultStyle = { width : "0px" , height : "0px" , position : "absolute" , top : "-1000px" , left : "-1000px" } ; options . attributes = options . attributes || defaultAttributes ; for ( var key in options . attributes ) { if ( options . attributes . hasOwnProperty ( key ) ) { frame . setAttribute ( key , options . attributes [ key ] ) ; } } options . style = options . style || defaultStyle ; if ( options . style ) { for ( var attr in options . style ) { if ( options . style . hasOwnProperty ( attr ) ) { frame . style [ attr ] = options . style [ attr ] ; } } } // Append and hookup after body tag opens _waitForBody ( { delay : delay , onready : function ( ) { ( container || document . body ) . appendChild ( frame ) ; this . rmload = _addLoadHandler . call ( this , frame ) ; _setIFrameLocation . call ( this , frame , options . url , ( false !== options . bust ) ) ; } . bind ( this ) } ) ; return frame ; }
Creates an iFrame in memory and sets the default attributes except the actual URL
Does not attach to DOM at this point
@param {Object} options a passed in configuration options
@param {String} options.url - the url to load,
@param {String} [options.style] - the CSS style to apply
@param {String} [options.style.width] width of iframe
@param {String} [options.style.height] height of iframe
.....
@param {Boolean} [options.bust = true] - optional flag to indicate usage of cache buster when loading the iframe (default to true),
@param {Function} [options.callback] - a callback to invoke after the iframe had been loaded,
@param {Object} [options.context] - optional context for the callback
@param {Object} [container] - the container in which the iframe should be created (if not supplied, document.body will be used)
@returns {Element} the attached iFrame element
@private
Creates an iFrame in memory and sets the default attributes except the actual URL Does not attach to DOM at this point