~facelessuser/beautifulsoup/lxml-fix

« back to all changes in this revision

Viewing changes to bs4/element.py

  • Committer: Leonard Richardson
  • Date: 2019-07-21 19:50:49 UTC
  • Revision ID: leonardr@segfault.org-20190721195049-vzupkzxai3bx3r8t
Implemented line number tracking for html5lib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
724
724
 
725
725
    def __init__(self, parser=None, builder=None, name=None, namespace=None,
726
726
                 prefix=None, attrs=None, parent=None, previous=None,
727
 
                 is_xml=None, lineno=None, offset=None):
 
727
                 is_xml=None, sourceline=None, sourcepos=None):
728
728
        "Basic constructor."
729
729
 
730
730
        if parser is None:
739
739
        self.namespace = namespace
740
740
        self.prefix = prefix
741
741
        if ((not builder or builder.store_line_numbers)
742
 
            and (lineno is not None or offset is not None)):
743
 
            self.lineno = lineno
744
 
            self.offset = offset
 
742
            and (sourceline is not None or sourcepos is not None)):
 
743
            self.sourceline = sourceline
 
744
            self.sourcepos = sourcepos
745
745
        if attrs is None:
746
746
            attrs = {}
747
747
        elif attrs: