comparison libervia/pages/_browser/slideshow.py @ 1408:ff5005783443

browser (slideshow): work around Brython's `children` wrong behavour: `children` is Brython is returning all node instead of only elements, see https://github.com/brython-dev/brython/issues/1657 .
author Goffi <goffi@goffi.org>
date Fri, 16 Apr 2021 18:47:39 +0200
parents 3c5054a22e7a
children
comparison
equal deleted inserted replaced
1407:5a132b85e1ac 1408:ff5005783443
61 self.swiper.slideTo(idx, 0) 61 self.swiper.slideTo(idx, 0)
62 62
63 def attach(self): 63 def attach(self):
64 # we hide other elts to avoid scrolling issues 64 # we hide other elts to avoid scrolling issues
65 for elt in document.body.children: 65 for elt in document.body.children:
66 self.hidden_elts[elt] = elt.style.display 66 try:
67 elt.style.display = "none" 67 self.hidden_elts[elt] = elt.style.display
68 except AttributeError:
69 pass
70 # FIXME: this is a workaround needed because Brython's children method
71 # is returning all nodes,
72 # cf. https://github.com/brython-dev/brython/issues/1657
73 # to be removed when Brython is fixed.
74 else:
75 elt.style.display = "none"
68 document.body <= self.slideshow_elt 76 document.body <= self.slideshow_elt
69 self.swiper = Swiper.new( 77 self.swiper = Swiper.new(
70 ".swiper-container", 78 ".swiper-container",
71 { 79 {
72 # default 0 value results in lot of accidental swipes, notably when media 80 # default 0 value results in lot of accidental swipes, notably when media