diff options
Diffstat (limited to 'bs4/element.py')
-rw-r--r-- | bs4/element.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bs4/element.py b/bs4/element.py index 73e3867..41acf45 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -724,7 +724,7 @@ class Tag(PageElement): def __init__(self, parser=None, builder=None, name=None, namespace=None, prefix=None, attrs=None, parent=None, previous=None, - is_xml=None): + is_xml=None, lineno=None, offset=None): "Basic constructor." if parser is None: @@ -738,6 +738,10 @@ class Tag(PageElement): self.name = name self.namespace = namespace self.prefix = prefix + if ((not builder or builder.store_line_numbers) + and (lineno is not None or offset is not None)): + self.lineno = lineno + self.offset = offset if attrs is None: attrs = {} elif attrs: |