Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .pytest.expect
Original file line number Diff line number Diff line change
Expand Up @@ -208,51 +208,6 @@ u'html5lib/tests/testdata/tree-construction/isindex.dat::3::cElementTree::parser
u'html5lib/tests/testdata/tree-construction/isindex.dat::3::cElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/isindex.dat::3::lxml::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/isindex.dat::3::lxml::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::DOM::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::DOM::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::DOM::treewalker': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::ElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::ElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::ElementTree::treewalker': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::cElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::cElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::cElementTree::treewalker': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::genshi::treewalker': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::lxml::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::lxml::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::0::lxml::treewalker': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::DOM::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::DOM::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::ElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::ElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::cElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::cElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::lxml::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::1::lxml::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::DOM::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::DOM::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::ElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::ElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::cElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::cElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::lxml::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::2::lxml::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::DOM::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::DOM::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::ElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::ElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::cElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::cElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::lxml::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::3::lxml::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::DOM::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::DOM::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::ElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::ElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::cElementTree::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::cElementTree::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::lxml::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/math.dat::4::lxml::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::DOM::parser::namespaced': FAIL
u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::DOM::parser::void-namespace': FAIL
u'html5lib/tests/testdata/tree-construction/menuitem-element.dat::3::ElementTree::parser::namespaced': FAIL
Expand Down
9 changes: 7 additions & 2 deletions html5lib/treebuilders/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,17 @@ def elementInScope(self, target, variant=None):
# If we pass a node in we match that. if we pass a string
# match any node with that name
exactNode = hasattr(target, "nameTuple")
if not exactNode:
if isinstance(target, text_type):
target = (namespaces["html"], target)
assert isinstance(target, tuple)

listElements, invert = listElementsMap[variant]

for node in reversed(self.openElements):
if (node.name == target and not exactNode or
node == target and exactNode):
if exactNode and node == target:
return True
elif not exactNode and node.nameTuple == target:
return True
elif (invert ^ (node.nameTuple in listElements)):
return False
Expand Down