Fossil SCM

Fixed the panel.style.hasOwnProperty() test in the default skin's js.txt so that it will work on IE8 and below. See code comment for rationale.

wyoung 2018-09-20 11:21 trunk
Commit e54095f9af464436c1c83c0db6bd21b8beb4743a197adb5edb39e63e6671b562
1 file changed +9 -1
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -19,11 +19,19 @@
1919
*/
2020
(function() {
2121
var panel = document.getElementById("hbdrop");
2222
if (!panel) return; // site admin might've nuked it
2323
var panelBorder = panel.style.border;
24
- var animate = panel.style.hasOwnProperty('transition');
24
+
25
+ // Disable animation if this browser doesn't support CSS transitions.
26
+ //
27
+ // We need this ugly calling form for IE < 9 since it doesn't give you
28
+ // a true Object for host-provided values such as 'panel'. That is,
29
+ // panel.style.hasOwnProperty() doesn't exist on IE8! Since the whole
30
+ // point of this test is to allow the code below to run without a JS
31
+ // error on deficient browsers, we can't just ignore this problem.
32
+ var animate = Object.prototype.hasOwnProperty.call(panel.style, 'transition');
2533
var animMS = 400;
2634
2735
// Calculate panel height despite its being hidden at call time.
2836
// Based on https://stackoverflow.com/a/29047447/142454
2937
var panelHeight; // computed on sitemap load
3038
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -19,11 +19,19 @@
19 */
20 (function() {
21 var panel = document.getElementById("hbdrop");
22 if (!panel) return; // site admin might've nuked it
23 var panelBorder = panel.style.border;
24 var animate = panel.style.hasOwnProperty('transition');
 
 
 
 
 
 
 
 
25 var animMS = 400;
26
27 // Calculate panel height despite its being hidden at call time.
28 // Based on https://stackoverflow.com/a/29047447/142454
29 var panelHeight; // computed on sitemap load
30
--- skins/default/js.txt
+++ skins/default/js.txt
@@ -19,11 +19,19 @@
19 */
20 (function() {
21 var panel = document.getElementById("hbdrop");
22 if (!panel) return; // site admin might've nuked it
23 var panelBorder = panel.style.border;
24
25 // Disable animation if this browser doesn't support CSS transitions.
26 //
27 // We need this ugly calling form for IE < 9 since it doesn't give you
28 // a true Object for host-provided values such as 'panel'. That is,
29 // panel.style.hasOwnProperty() doesn't exist on IE8! Since the whole
30 // point of this test is to allow the code below to run without a JS
31 // error on deficient browsers, we can't just ignore this problem.
32 var animate = Object.prototype.hasOwnProperty.call(panel.style, 'transition');
33 var animMS = 400;
34
35 // Calculate panel height despite its being hidden at call time.
36 // Based on https://stackoverflow.com/a/29047447/142454
37 var panelHeight; // computed on sitemap load
38

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button