Skip to content

Commit

Permalink
Avoid useless function call to collect anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Oct 24, 2022
1 parent 71e9e25 commit 7767b53
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion weasyprint/css/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ def computed_from_cascaded(element, cascaded, parent_style, pseudo_type=None,

style = ComputedStyle(
parent_style, cascaded, element, pseudo_type, root_style, base_url)
if target_collector:
if target_collector and style['anchor']:
target_collector.collect_anchor(style['anchor'])
return style

Expand Down
2 changes: 1 addition & 1 deletion weasyprint/css/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self):

def collect_anchor(self, anchor_name):
"""Create a TargetLookupItem for the given `anchor_name``."""
if anchor_name and isinstance(anchor_name, str):
if isinstance(anchor_name, str):
if self.target_lookup_items.get(anchor_name) is not None:
LOGGER.warning('Anchor defined twice: %r', anchor_name)
else:
Expand Down

0 comments on commit 7767b53

Please sign in to comment.