8000 Merge pull request #55 from ambv/master · bertothunder/html5lib-python@81b97d5 · GitHub
[go: up one dir, main page]

Skip to content

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

Appearance settings

Commit 81b97d5

Browse files
committed
Merge pull request html5lib#55 from ambv/master
Use OrderedDict for arguments in etree walker
2 parents c18094a + 84c1206 commit 81b97d5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

html5lib/treewalkers/etree.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
from __future__ import absolute_import, division, unicode_literals
22

3+
try:
4+
from collections import OrderedDict
5+
except ImportError:
6+
try:
7+
from ordereddict import OrderedDict
8+
except ImportError:
9+
OrderedDict = dict
310
import gettext
411
_ = gettext.gettext
512

@@ -61,7 +68,7 @@ def getNodeDetails(self, node):
6168
else:
6269
namespace = None
6370
tag = node.tag
64-
attrs = {}
71+
attrs = OrderedDict()
6572
for name, value in list(node.attrib.items()):
6673
match = tag_regexp.match(name)
6774
if match:

0 commit comments

Comments
 (0)
0