Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #239: make elementInScope consider namespaces for target#262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionshtml5lib/treebuilders/_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp