corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | define([ |
2 | "../core", |
||
3 | "../manipulation" // appendTo |
||
4 | ], function( jQuery ) { |
||
5 | |||
6 | var iframe, |
||
7 | elemdisplay = {}; |
||
8 | |||
9 | /** |
||
10 | * Retrieve the actual display of a element |
||
11 | * @param {String} name nodeName of the element |
||
12 | * @param {Object} doc Document object |
||
13 | */ |
||
14 | // Called only from within defaultDisplay |
||
15 | function actualDisplay( name, doc ) { |
||
16 | var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), |
||
17 | |||
18 | // getDefaultComputedStyle might be reliably used only on attached element |
||
19 | display = window.getDefaultComputedStyle ? |
||
20 | |||
21 | // Use of this method is a temporary fix (more like optmization) until something better comes along, |
||
22 | // since it was removed from specification and supported only in FF |
||
23 | window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); |
||
24 | |||
25 | // We don't have any data stored on the element, |
||
26 | // so use "detach" method as fast way to get rid of the element |
||
27 | elem.detach(); |
||
28 | |||
29 | return display; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Try to determine the default display value of an element |
||
34 | * @param {String} nodeName |
||
35 | */ |
||
36 | function defaultDisplay( nodeName ) { |
||
37 | var doc = document, |
||
38 | display = elemdisplay[ nodeName ]; |
||
39 | |||
40 | if ( !display ) { |
||
41 | display = actualDisplay( nodeName, doc ); |
||
42 | |||
43 | // If the simple way fails, read from inside an iframe |
||
44 | if ( display === "none" || !display ) { |
||
45 | |||
46 | // Use the already-created iframe if possible |
||
47 | iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); |
||
48 | |||
49 | // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse |
||
50 | doc = iframe[ 0 ].contentDocument; |
||
51 | |||
52 | // Support: IE |
||
53 | doc.write(); |
||
54 | doc.close(); |
||
55 | |||
56 | display = actualDisplay( nodeName, doc ); |
||
57 | iframe.detach(); |
||
58 | } |
||
59 | |||
60 | // Store the correct default display |
||
61 | elemdisplay[ nodeName ] = display; |
||
62 | } |
||
63 | |||
64 | return display; |
||
65 | } |
||
66 | |||
67 | return defaultDisplay; |
||
68 | |||
69 | }); |