Projet

Général

Profil

Paste
Télécharger (4,74 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / libraries / flexslider-2.5.0 / bower_components / jquery / src / css / support.js @ 0aee3c58

1
define([
2
        "../core",
3
        "../var/support"
4
], function( jQuery, support ) {
5

    
6
(function() {
7
        // Minified: var b,c,d,e,f,g, h,i
8
        var div, style, a, pixelPositionVal, boxSizingReliableVal,
9
                reliableHiddenOffsetsVal, reliableMarginRightVal;
10

    
11
        // Setup
12
        div = document.createElement( "div" );
13
        div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
14
        a = div.getElementsByTagName( "a" )[ 0 ];
15
        style = a && a.style;
16

    
17
        // Finish early in limited (non-browser) environments
18
        if ( !style ) {
19
                return;
20
        }
21

    
22
        style.cssText = "float:left;opacity:.5";
23

    
24
        // Support: IE<9
25
        // Make sure that element opacity exists (as opposed to filter)
26
        support.opacity = style.opacity === "0.5";
27

    
28
        // Verify style float existence
29
        // (IE uses styleFloat instead of cssFloat)
30
        support.cssFloat = !!style.cssFloat;
31

    
32
        div.style.backgroundClip = "content-box";
33
        div.cloneNode( true ).style.backgroundClip = "";
34
        support.clearCloneStyle = div.style.backgroundClip === "content-box";
35

    
36
        // Support: Firefox<29, Android 2.3
37
        // Vendor-prefix box-sizing
38
        support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" ||
39
                style.WebkitBoxSizing === "";
40

    
41
        jQuery.extend(support, {
42
                reliableHiddenOffsets: function() {
43
                        if ( reliableHiddenOffsetsVal == null ) {
44
                                computeStyleTests();
45
                        }
46
                        return reliableHiddenOffsetsVal;
47
                },
48

    
49
                boxSizingReliable: function() {
50
                        if ( boxSizingReliableVal == null ) {
51
                                computeStyleTests();
52
                        }
53
                        return boxSizingReliableVal;
54
                },
55

    
56
                pixelPosition: function() {
57
                        if ( pixelPositionVal == null ) {
58
                                computeStyleTests();
59
                        }
60
                        return pixelPositionVal;
61
                },
62

    
63
                // Support: Android 2.3
64
                reliableMarginRight: function() {
65
                        if ( reliableMarginRightVal == null ) {
66
                                computeStyleTests();
67
                        }
68
                        return reliableMarginRightVal;
69
                }
70
        });
71

    
72
        function computeStyleTests() {
73
                // Minified: var b,c,d,j
74
                var div, body, container, contents;
75

    
76
                body = document.getElementsByTagName( "body" )[ 0 ];
77
                if ( !body || !body.style ) {
78
                        // Test fired too early or in an unsupported environment, exit.
79
                        return;
80
                }
81

    
82
                // Setup
83
                div = document.createElement( "div" );
84
                container = document.createElement( "div" );
85
                container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
86
                body.appendChild( container ).appendChild( div );
87

    
88
                div.style.cssText =
89
                        // Support: Firefox<29, Android 2.3
90
                        // Vendor-prefix box-sizing
91
                        "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
92
                        "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
93
                        "border:1px;padding:1px;width:4px;position:absolute";
94

    
95
                // Support: IE<9
96
                // Assume reasonable values in the absence of getComputedStyle
97
                pixelPositionVal = boxSizingReliableVal = false;
98
                reliableMarginRightVal = true;
99

    
100
                // Check for getComputedStyle so that this code is not run in IE<9.
101
                if ( window.getComputedStyle ) {
102
                        pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
103
                        boxSizingReliableVal =
104
                                ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
105

    
106
                        // Support: Android 2.3
107
                        // Div with explicit width and no margin-right incorrectly
108
                        // gets computed margin-right based on width of container (#3333)
109
                        // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
110
                        contents = div.appendChild( document.createElement( "div" ) );
111

    
112
                        // Reset CSS: box-sizing; display; margin; border; padding
113
                        contents.style.cssText = div.style.cssText =
114
                                // Support: Firefox<29, Android 2.3
115
                                // Vendor-prefix box-sizing
116
                                "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
117
                                "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
118
                        contents.style.marginRight = contents.style.width = "0";
119
                        div.style.width = "1px";
120

    
121
                        reliableMarginRightVal =
122
                                !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight );
123

    
124
                        div.removeChild( contents );
125
                }
126

    
127
                // Support: IE8
128
                // Check if table cells still have offsetWidth/Height when they are set
129
                // to display:none and there are still other visible table cells in a
130
                // table row; if so, offsetWidth/Height are not reliable for use when
131
                // determining if an element has been hidden directly using
132
                // display:none (it is still safe to use offsets if a parent element is
133
                // hidden; don safety goggles and see bug #4512 for more information).
134
                div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
135
                contents = div.getElementsByTagName( "td" );
136
                contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
137
                reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
138
                if ( reliableHiddenOffsetsVal ) {
139
                        contents[ 0 ].style.display = "";
140
                        contents[ 1 ].style.display = "none";
141
                        reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
142
                }
143

    
144
                body.removeChild( container );
145
        }
146

    
147
})();
148

    
149
return support;
150

    
151
});