diff options
author | Thomas Park <thomas@thomaspark.me> | 2014-11-01 21:05:20 -0400 |
---|---|---|
committer | Thomas Park <thomas@thomaspark.me> | 2014-11-01 21:05:20 -0400 |
commit | 918b2a49ca6ac074bac47f6685cf3a687a4c6212 (patch) | |
tree | 5d11a2820c6e0726a6ee071724557d12a90c6709 /bower_components/jquery/src/css | |
parent | 5c12c8a99c04fbff7d13e97679121a5de13e01d6 (diff) |
3.2.0 -> 3.3.0
Diffstat (limited to 'bower_components/jquery/src/css')
-rw-r--r-- | bower_components/jquery/src/css/addGetHookIf.js | 24 | ||||
-rw-r--r-- | bower_components/jquery/src/css/curCSS.js | 57 | ||||
-rw-r--r-- | bower_components/jquery/src/css/defaultDisplay.js | 70 | ||||
-rw-r--r-- | bower_components/jquery/src/css/hiddenVisibleSelectors.js | 15 | ||||
-rw-r--r-- | bower_components/jquery/src/css/support.js | 91 | ||||
-rw-r--r-- | bower_components/jquery/src/css/swap.js | 28 | ||||
-rw-r--r-- | bower_components/jquery/src/css/var/cssExpand.js | 3 | ||||
-rw-r--r-- | bower_components/jquery/src/css/var/getStyles.js | 5 | ||||
-rw-r--r-- | bower_components/jquery/src/css/var/isHidden.js | 13 | ||||
-rw-r--r-- | bower_components/jquery/src/css/var/rmargin.js | 3 | ||||
-rw-r--r-- | bower_components/jquery/src/css/var/rnumnonpx.js | 5 |
11 files changed, 314 insertions, 0 deletions
diff --git a/bower_components/jquery/src/css/addGetHookIf.js b/bower_components/jquery/src/css/addGetHookIf.js new file mode 100644 index 00000000..81d694cb --- /dev/null +++ b/bower_components/jquery/src/css/addGetHookIf.js @@ -0,0 +1,24 @@ +define(function() { + +function addGetHookIf( conditionFn, hookFn ) { + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + // Hook not needed (or it's not possible to use it due to missing dependency), + // remove it. + // Since there are no other hooks for marginRight, remove the whole object. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + + return (this.get = hookFn).apply( this, arguments ); + } + }; +} + +return addGetHookIf; + +}); diff --git a/bower_components/jquery/src/css/curCSS.js b/bower_components/jquery/src/css/curCSS.js new file mode 100644 index 00000000..abcc8cb7 --- /dev/null +++ b/bower_components/jquery/src/css/curCSS.js @@ -0,0 +1,57 @@ +define([ + "../core", + "./var/rnumnonpx", + "./var/rmargin", + "./var/getStyles", + "../selector" // contains +], function( jQuery, rnumnonpx, rmargin, getStyles ) { + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + style = elem.style; + + computed = computed || getStyles( elem ); + + // Support: IE9 + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + if ( computed ) { + ret = computed.getPropertyValue( name ) || computed[ name ]; + } + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // Support: iOS < 6 + // A tribute to the "awesome hack by Dean Edwards" + // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + // Support: IE + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + +return curCSS; +}); diff --git a/bower_components/jquery/src/css/defaultDisplay.js b/bower_components/jquery/src/css/defaultDisplay.js new file mode 100644 index 00000000..631b9ba8 --- /dev/null +++ b/bower_components/jquery/src/css/defaultDisplay.js @@ -0,0 +1,70 @@ +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 defaultDisplay +function actualDisplay( name, doc ) { + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? + + // Use of this method is a temporary fix (more like optmization) until something better comes along, + // since it was removed from specification and supported only in FF + style.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; + +}); diff --git a/bower_components/jquery/src/css/hiddenVisibleSelectors.js b/bower_components/jquery/src/css/hiddenVisibleSelectors.js new file mode 100644 index 00000000..c7f1c7ee --- /dev/null +++ b/bower_components/jquery/src/css/hiddenVisibleSelectors.js @@ -0,0 +1,15 @@ +define([ + "../core", + "../selector" +], function( jQuery ) { + +jQuery.expr.filters.hidden = function( elem ) { + // Support: Opera <= 12.12 + // Opera reports offsetWidths and offsetHeights less than zero on some elements + return elem.offsetWidth <= 0 && elem.offsetHeight <= 0; +}; +jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); +}; + +}); diff --git a/bower_components/jquery/src/css/support.js b/bower_components/jquery/src/css/support.js new file mode 100644 index 00000000..4a4d75c4 --- /dev/null +++ b/bower_components/jquery/src/css/support.js @@ -0,0 +1,91 @@ +define([ + "../core", + "../var/support" +], function( jQuery, support ) { + +(function() { + var pixelPositionVal, boxSizingReliableVal, + docElem = document.documentElement, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + if ( !div.style ) { + return; + } + + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" + + "position:absolute"; + container.appendChild( div ); + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computePixelPositionAndBoxSizingReliable() { + div.style.cssText = + // Support: Firefox<29, Android 2.3 + // Vendor-prefix box-sizing + "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + + "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + + "border:1px;padding:1px;width:4px;position:absolute"; + div.innerHTML = ""; + docElem.appendChild( container ); + + var divStyle = window.getComputedStyle( div, null ); + pixelPositionVal = divStyle.top !== "1%"; + boxSizingReliableVal = divStyle.width === "4px"; + + docElem.removeChild( container ); + } + + // Support: node.js jsdom + // Don't assume that getComputedStyle is a property of the global object + if ( window.getComputedStyle ) { + jQuery.extend( support, { + pixelPosition: function() { + // This test is executed only once but we still do memoizing + // since we can use the boxSizingReliable pre-computing. + // No need to check if the test was already performed, though. + computePixelPositionAndBoxSizingReliable(); + return pixelPositionVal; + }, + boxSizingReliable: function() { + if ( boxSizingReliableVal == null ) { + computePixelPositionAndBoxSizingReliable(); + } + return boxSizingReliableVal; + }, + reliableMarginRight: function() { + // Support: Android 2.3 + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // This support function is only executed once so no memoizing is needed. + var ret, + marginDiv = div.appendChild( document.createElement( "div" ) ); + + // Reset CSS: box-sizing; display; margin; border; padding + marginDiv.style.cssText = div.style.cssText = + // Support: Firefox<29, Android 2.3 + // Vendor-prefix box-sizing + "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + + "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + docElem.appendChild( container ); + + ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight ); + + docElem.removeChild( container ); + + return ret; + } + }); + } +})(); + +return support; + +}); diff --git a/bower_components/jquery/src/css/swap.js b/bower_components/jquery/src/css/swap.js new file mode 100644 index 00000000..ce164353 --- /dev/null +++ b/bower_components/jquery/src/css/swap.js @@ -0,0 +1,28 @@ +define([ + "../core" +], function( jQuery ) { + +// A method for quickly swapping in/out CSS properties to get correct calculations. +jQuery.swap = function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + +return jQuery.swap; + +}); diff --git a/bower_components/jquery/src/css/var/cssExpand.js b/bower_components/jquery/src/css/var/cssExpand.js new file mode 100644 index 00000000..91e90a88 --- /dev/null +++ b/bower_components/jquery/src/css/var/cssExpand.js @@ -0,0 +1,3 @@ +define(function() { + return [ "Top", "Right", "Bottom", "Left" ]; +}); diff --git a/bower_components/jquery/src/css/var/getStyles.js b/bower_components/jquery/src/css/var/getStyles.js new file mode 100644 index 00000000..26cc0a25 --- /dev/null +++ b/bower_components/jquery/src/css/var/getStyles.js @@ -0,0 +1,5 @@ +define(function() { + return function( elem ) { + return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); + }; +}); diff --git a/bower_components/jquery/src/css/var/isHidden.js b/bower_components/jquery/src/css/var/isHidden.js new file mode 100644 index 00000000..15ab81a9 --- /dev/null +++ b/bower_components/jquery/src/css/var/isHidden.js @@ -0,0 +1,13 @@ +define([ + "../../core", + "../../selector" + // css is assumed +], function( jQuery ) { + + return function( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); + }; +}); diff --git a/bower_components/jquery/src/css/var/rmargin.js b/bower_components/jquery/src/css/var/rmargin.js new file mode 100644 index 00000000..da0438db --- /dev/null +++ b/bower_components/jquery/src/css/var/rmargin.js @@ -0,0 +1,3 @@ +define(function() { + return (/^margin/); +}); diff --git a/bower_components/jquery/src/css/var/rnumnonpx.js b/bower_components/jquery/src/css/var/rnumnonpx.js new file mode 100644 index 00000000..c93be285 --- /dev/null +++ b/bower_components/jquery/src/css/var/rnumnonpx.js @@ -0,0 +1,5 @@ +define([ + "../../var/pnum" +], function( pnum ) { + return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); +}); |