scratch – Blame information for rev 58

Subversion Repositories:
Rev:
Rev Author Line No. Line
58 office 1 define( [
2 "../core",
3 "../var/document",
4 "../var/documentElement",
5 "../var/support"
6 ], function( jQuery, document, documentElement, support ) {
7  
8 "use strict";
9  
10 ( function() {
11  
12 // Executing both pixelPosition & boxSizingReliable tests require only one layout
13 // so they're executed at the same time to save the second computation.
14 function computeStyleTests() {
15  
16 // This is a singleton, we need to execute it only once
17 if ( !div ) {
18 return;
19 }
20  
21 div.style.cssText =
22 "box-sizing:border-box;" +
23 "position:relative;display:block;" +
24 "margin:auto;border:1px;padding:1px;" +
25 "top:1%;width:50%";
26 div.innerHTML = "";
27 documentElement.appendChild( container );
28  
29 var divStyle = window.getComputedStyle( div );
30 pixelPositionVal = divStyle.top !== "1%";
31  
32 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
33 reliableMarginLeftVal = divStyle.marginLeft === "2px";
34 boxSizingReliableVal = divStyle.width === "4px";
35  
36 // Support: Android 4.0 - 4.3 only
37 // Some styles come back with percentage values, even though they shouldn't
38 div.style.marginRight = "50%";
39 pixelMarginRightVal = divStyle.marginRight === "4px";
40  
41 documentElement.removeChild( container );
42  
43 // Nullify the div so it wouldn't be stored in the memory and
44 // it will also be a sign that checks already performed
45 div = null;
46 }
47  
48 var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
49 container = document.createElement( "div" ),
50 div = document.createElement( "div" );
51  
52 // Finish early in limited (non-browser) environments
53 if ( !div.style ) {
54 return;
55 }
56  
57 // Support: IE <=9 - 11 only
58 // Style of cloned element affects source element cloned (#8908)
59 div.style.backgroundClip = "content-box";
60 div.cloneNode( true ).style.backgroundClip = "";
61 support.clearCloneStyle = div.style.backgroundClip === "content-box";
62  
63 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
64 "padding:0;margin-top:1px;position:absolute";
65 container.appendChild( div );
66  
67 jQuery.extend( support, {
68 pixelPosition: function() {
69 computeStyleTests();
70 return pixelPositionVal;
71 },
72 boxSizingReliable: function() {
73 computeStyleTests();
74 return boxSizingReliableVal;
75 },
76 pixelMarginRight: function() {
77 computeStyleTests();
78 return pixelMarginRightVal;
79 },
80 reliableMarginLeft: function() {
81 computeStyleTests();
82 return reliableMarginLeftVal;
83 }
84 } );
85 } )();
86  
87 return support;
88  
89 } );