Mercurial > libervia-web
changeset 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 | 5a132b85e1ac |
children | 83b477d36725 |
files | libervia/pages/_browser/slideshow.py |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/pages/_browser/slideshow.py Fri Apr 16 18:45:44 2021 +0200 +++ b/libervia/pages/_browser/slideshow.py Fri Apr 16 18:47:39 2021 +0200 @@ -63,8 +63,16 @@ def attach(self): # we hide other elts to avoid scrolling issues for elt in document.body.children: - self.hidden_elts[elt] = elt.style.display - elt.style.display = "none" + try: + self.hidden_elts[elt] = elt.style.display + except AttributeError: + pass + # FIXME: this is a workaround needed because Brython's children method + # is returning all nodes, + # cf. https://github.com/brython-dev/brython/issues/1657 + # to be removed when Brython is fixed. + else: + elt.style.display = "none" document.body <= self.slideshow_elt self.swiper = Swiper.new( ".swiper-container",