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

Commit29dbf97

Browse files
committed
fixup! Preserve attribute order when parsing
Add a parser test for duplicate attributes; fix.
1 parentd987624 commit29dbf97

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

‎html5lib/html5parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def normalizeToken(self, token):
275275
""" HTML5 specific normalizations to the token stream """
276276

277277
iftoken["type"]==tokenTypes["StartTag"]:
278-
token["data"]=OrderedDict(token['data'])
278+
token["data"]=OrderedDict(token['data'][::-1])
279279

280280
returntoken
281281

‎html5lib/tests/test_parser2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,10 @@ def test_namespace_html_elements_1_etree():
4949

5050
deftest_unicode_file():
5151
assertparse(io.StringIO("a"))isnotNone
52+
53+
54+
deftest_duplicate_attribute():
55+
# This is here because we impl it in parser and not tokenizer
56+
doc=parse('<p class=a class=b>')
57+
el=doc[1][0]
58+
assertel.get("class")=="a"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp