Blame | Last modification | View Log | RSS feed
define(["../core","../manipulation" // appendTo], function( jQuery ) {var iframe,elemdisplay = {};/*** Retrieve the actual display of a element* @param {String} name nodeName of the element* @param {Object} doc Document object*/// Called only from within defaultDisplayfunction actualDisplay( name, doc ) {var style,elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),// getDefaultComputedStyle might be reliably used only on attached elementdisplay = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?// Use of this method is a temporary fix (more like optimization) until something better comes along,// since it was removed from specification and supported only in FFstyle.display : jQuery.css( elem[ 0 ], "display" );// We don't have any data stored on the element,// so use "detach" method as fast way to get rid of the elementelem.detach();return display;}/*** Try to determine the default display value of an element* @param {String} nodeName*/function defaultDisplay( nodeName ) {var doc = document,display = elemdisplay[ nodeName ];if ( !display ) {display = actualDisplay( nodeName, doc );// If the simple way fails, read from inside an iframeif ( display === "none" || !display ) {// Use the already-created iframe if possibleiframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );// Always write a new HTML skeleton so Webkit and Firefox don't choke on reusedoc = iframe[ 0 ].contentDocument;// Support: IEdoc.write();doc.close();display = actualDisplay( nodeName, doc );iframe.detach();}// Store the correct default displayelemdisplay[ nodeName ] = display;}return display;}return defaultDisplay;});