@@ -97,7 +97,9 @@ <h2>Node.js in the Industry</h2>
97
97
document . getElementById ( 'downloadbutton' ) . onclick = function ( e ) {
98
98
e = e || window . event ;
99
99
e . stopPropagation && e . stopPropagation ( ) ;
100
- downloadDialogUpdate ( ) ;
100
+ e . cancelBubble = true ;
101
+ // need to give the hash a tick to update
102
+ setTimeout ( downloadDialogUpdate , 0 ) ;
101
103
} ;
102
104
103
105
document . getElementById ( 'download-close' ) . onclick =
@@ -110,6 +112,7 @@ <h2>Node.js in the Industry</h2>
110
112
document . getElementById ( 'download' ) . onclick = function ( e ) {
111
113
e = e || window . event ;
112
114
e . stopPropagation && e . stopPropagation ( ) ;
115
+ e . cancelBubble = true ;
113
116
} ;
114
117
115
118
// I keep expecting <Esc> to close the dialog...
@@ -123,11 +126,20 @@ <h2>Node.js in the Industry</h2>
123
126
// hacky workaround for old ie browsers that don't support :target css.
124
127
function downloadDialogUpdate ( ) {
125
128
var div = document . getElementById ( 'download' ) ;
129
+ if ( ! div ) return ;
126
130
var expect = location . hash === '#download' ? 'block' : 'none' ;
127
- var m = div . getComputedStyle || div . currentStyle || null ;
128
- if ( ! m ) return ;
129
- var actual = m . call ( div , 'display' ) ;
130
- if ( actual !== expect ) div . style . diplay = expect ;
131
+ var actual = div . currentStyle ? div . currentStyle . display
132
+ : window . getComputedStyle
133
+ ? document . defaultView . getComputedStyle ( div , null ) . getPropertyValue ( 'display' )
134
+ : null ;
135
+
136
+ // it looks like a string, but it might not actually be a string.
137
+ // explicitly cast for MSIE 6 and 7.
138
+ actual = '' + actual ;
139
+ expect = '' + expect ;
140
+ if ( actual !== expect ) {
141
+ div . style . display = expect ;
142
+ }
131
143
}
132
144
downloadDialogUpdate ( ) ;
133
145
} ) ( ) ; </ script >
0 commit comments