scratch – Blame information for rev 125

Subversion Repositories:
Rev:
Rev Author Line No. Line
125 office 1 define([
58 office 2 "../core",
3 "../var/support"
125 office 4 ], function( jQuery, support ) {
58 office 5  
125 office 6 (function() {
7 var pixelPositionVal, boxSizingReliableVal,
8 docElem = document.documentElement,
9 container = document.createElement( "div" ),
10 div = document.createElement( "div" );
58 office 11  
125 office 12 if ( !div.style ) {
13 return;
14 }
58 office 15  
125 office 16 // Support: IE9-11+
17 // Style of cloned element affects source element cloned (#8908)
18 div.style.backgroundClip = "content-box";
19 div.cloneNode( true ).style.backgroundClip = "";
20 support.clearCloneStyle = div.style.backgroundClip === "content-box";
21  
22 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
23 "position:absolute";
24 container.appendChild( div );
25  
58 office 26 // Executing both pixelPosition & boxSizingReliable tests require only one layout
27 // so they're executed at the same time to save the second computation.
125 office 28 function computePixelPositionAndBoxSizingReliable() {
58 office 29 div.style.cssText =
125 office 30 // Support: Firefox<29, Android 2.3
31 // Vendor-prefix box-sizing
32 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
33 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
34 "border:1px;padding:1px;width:4px;position:absolute";
58 office 35 div.innerHTML = "";
125 office 36 docElem.appendChild( container );
58 office 37  
125 office 38 var divStyle = window.getComputedStyle( div, null );
58 office 39 pixelPositionVal = divStyle.top !== "1%";
40 boxSizingReliableVal = divStyle.width === "4px";
41  
125 office 42 docElem.removeChild( container );
43 }
58 office 44  
125 office 45 // Support: node.js jsdom
46 // Don't assume that getComputedStyle is a property of the global object
47 if ( window.getComputedStyle ) {
48 jQuery.extend( support, {
49 pixelPosition: function() {
58 office 50  
125 office 51 // This test is executed only once but we still do memoizing
52 // since we can use the boxSizingReliable pre-computing.
53 // No need to check if the test was already performed, though.
54 computePixelPositionAndBoxSizingReliable();
55 return pixelPositionVal;
56 },
57 boxSizingReliable: function() {
58 if ( boxSizingReliableVal == null ) {
59 computePixelPositionAndBoxSizingReliable();
60 }
61 return boxSizingReliableVal;
62 },
63 reliableMarginRight: function() {
58 office 64  
125 office 65 // Support: Android 2.3
66 // Check if div with explicit width and no margin-right incorrectly
67 // gets computed margin-right based on width of container. (#3333)
68 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
69 // This support function is only executed once so no memoizing is needed.
70 var ret,
71 marginDiv = div.appendChild( document.createElement( "div" ) );
58 office 72  
125 office 73 // Reset CSS: box-sizing; display; margin; border; padding
74 marginDiv.style.cssText = div.style.cssText =
75 // Support: Firefox<29, Android 2.3
76 // Vendor-prefix box-sizing
77 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
78 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
79 marginDiv.style.marginRight = marginDiv.style.width = "0";
80 div.style.width = "1px";
81 docElem.appendChild( container );
58 office 82  
125 office 83 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
58 office 84  
125 office 85 docElem.removeChild( container );
86 div.removeChild( marginDiv );
58 office 87  
125 office 88 return ret;
89 }
90 });
91 }
92 })();
58 office 93  
94 return support;
95  
125 office 96 });