BVB Source Codes

flexboxfroggy Show defaultDisplay.js Source code

Return Download flexboxfroggy: download defaultDisplay.js Source code - Download flexboxfroggy Source code - Type:.js
  1. define([
  2.         "../core",
  3.         "../manipulation" // appendTo
  4. ], function( jQuery ) {
  5.  
  6. var iframe,
  7.         elemdisplay = {};
  8.  
  9. /**
  10.  * Retrieve the actual display of a element
  11.  * @param {String} name nodeName of the element
  12.  * @param {Object} doc Document object
  13.  */
  14. // Called only from within defaultDisplay
  15. function actualDisplay( name, doc ) {
  16.         var style,
  17.                 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
  18.  
  19.                 // getDefaultComputedStyle might be reliably used only on attached element
  20.                 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
  21.  
  22.                         // Use of this method is a temporary fix (more like optimization) until something better comes along,
  23.                         // since it was removed from specification and supported only in FF
  24.                         style.display : jQuery.css( elem[ 0 ], "display" );
  25.  
  26.         // We don't have any data stored on the element,
  27.         // so use "detach" method as fast way to get rid of the element
  28.         elem.detach();
  29.  
  30.         return display;
  31. }
  32.  
  33. /**
  34.  * Try to determine the default display value of an element
  35.  * @param {String} nodeName
  36.  */
  37. function defaultDisplay( nodeName ) {
  38.         var doc = document,
  39.                 display = elemdisplay[ nodeName ];
  40.  
  41.         if ( !display ) {
  42.                 display = actualDisplay( nodeName, doc );
  43.  
  44.                 // If the simple way fails, read from inside an iframe
  45.                 if ( display === "none" || !display ) {
  46.  
  47.                         // Use the already-created iframe if possible
  48.                         iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
  49.  
  50.                         // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  51.                         doc = iframe[ 0 ].contentDocument;
  52.  
  53.                         // Support: IE
  54.                         doc.write();
  55.                         doc.close();
  56.  
  57.                         display = actualDisplay( nodeName, doc );
  58.                         iframe.detach();
  59.                 }
  60.  
  61.                 // Store the correct default display
  62.                 elemdisplay[ nodeName ] = display;
  63.         }
  64.  
  65.         return display;
  66. }
  67.  
  68. return defaultDisplay;
  69.  
  70. });
  71.  
downloaddefaultDisplay.js Source code - Download flexboxfroggy Source code
Related Source Codes/Software:
phpDocumentor2 - Documentation Generator for PHP ... 2017-04-22
cmus - Small, fast and powerful console music player for ... 2017-04-22
Ink - An HTML5/CSS3 framework used at SAPO for fast and ... 2017-04-22
memory-stats.js - minimal monitor for JS Heap Size via performance.m... 2017-04-22
LayoutKit - LayoutKit is a fast view layout library for iOS, m... 2017-04-22
wicked - Use wicked to turn your controller into a wizard ... 2017-04-22
Begin-Latex-in-minutes - Brief Intro to LaTeX for beginners that helps you ... 2017-04-22
guard-livereload - Guard::LiveReload automatically reload your browse... 2017-04-22
grit - **Grit is no longer maintained. Check out libgit2/... 2017-04-22
grr - GRR Rapid Response: remote live forensics for inci... 2017-04-22
rack-cors - Rack Middleware for handling Cross-Origin Resource... 2017-04-29
react-redux-tutorial - react-redux-tutorial in Chinese, catalog &&... 2017-04-29
swifter - Tiny http server engine written in Swift programmi... 2017-04-29
Chartbuilder - A front-end charting application that facilitates ... 2017-04-29
offline-first - 2017-04-29
plotly.py - An interactive, browser-based graphing library for... 2017-04-29
statsmodels - Statsmodels: statistical modeling and econometrics... 2017-04-29
android-maps-utils - Handy extensions to the Google Maps Android API. 2017-04-29
enyo - A JavaScript application framework emphasizing mod... 2017-04-29
darkforestGo - DarkForest, the Facebook Go engine. 2017-04-29

 Back to top