diff options
author | Leonard Richardson <leonardr@segfault.org> | 2023-04-17 09:34:58 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2023-04-17 09:34:58 -0400 |
commit | 31eb728f84cd795f432838ba58d2bbf9502520db (patch) | |
tree | 9937db86e970e80b4ebf6a13a3abd3db5f7da007 /bs4/element.py | |
parent | c4a7d44e76b1784185946682d4111759f48ac0bd (diff) |
Fixed a regression such that if you set .hidden on a tag, the tag
becomes invisible but its contents are still visible. User manipulation
of .hidden is not a documented or supported feature, so don't do this,
but it's not too difficult to keep the old behavior working.
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bs4/element.py b/bs4/element.py index 33cbc19..0aefe73 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -1845,6 +1845,11 @@ class Tag(PageElement): return space_before + s + space_after def _format_tag(self, eventual_encoding, formatter, opening): + if self.hidden: + # A hidden tag is invisible, although its contents + # are visible. + return '' + # A tag starts with the < character (see below). # Then the / character, if this is a closing tag. |