diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2015-04-02 16:57:33 -0400 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2015-05-11 13:00:49 -0400 |
commit | 86419b10bfa5e3b71a7d416288ab806d47a31d1f (patch) | |
tree | 0e67bab0273e904df2f308ab26980291ec22adeb /src/css/defaultDisplay.js | |
parent | 5c3101fee60046fa7976b3131fada8dfe9fbd53e (diff) | |
download | jquery-86419b10bfa5e3b71a7d416288ab806d47a31d1f.tar.gz jquery-86419b10bfa5e3b71a7d416288ab806d47a31d1f.zip |
CSS: Ignore the CSS cascade in show()/hide()/etc.
Fixes gh-1767
Fixes gh-2071
Closes gh-2180
Diffstat (limited to 'src/css/defaultDisplay.js')
-rw-r--r-- | src/css/defaultDisplay.js | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/css/defaultDisplay.js b/src/css/defaultDisplay.js deleted file mode 100644 index 3771be6d1..000000000 --- a/src/css/defaultDisplay.js +++ /dev/null @@ -1,71 +0,0 @@ -define([ - "../core", - "../var/document", - "../manipulation" // appendTo -], function( jQuery, document ) { - -var iframe, - elemdisplay = { - - // Support: Firefox - // We have to pre-define these values for FF (#10227) - HTML: "block", - BODY: "block" - }; - -/** - * Retrieve the actual display of a element - * @param {String} name nodeName of the element - * @param {Object} doc Document object - */ -// Called only from within defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - - 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 element - elem.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 iframe - if ( display === "none" || !display ) { - - // Use the already-created iframe if possible - iframe = (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 reuse - doc = iframe[ 0 ].contentDocument; - - // Support: IE - doc.write(); - doc.close(); - - display = actualDisplay( nodeName, doc ); - iframe.detach(); - } - - // Store the correct default display - elemdisplay[ nodeName ] = display; - } - - return display; -} - -return defaultDisplay; -}); |