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

Allow self closing <col /> tags.#244

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
gsnedders merged 1 commit intohtml5lib:masterfromjdufresne:col-self-closing
Jun 27, 2016
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
1 change: 1 addition & 0 deletionsAUTHORS.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,3 +41,4 @@ Patches and suggestions
- Jim Baker
- Michael[tm] Smith
- Marc Abramowitz
- Jon Dufresne
9 changes: 6 additions & 3 deletionshtml5lib/html5parser.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -171,8 +171,10 @@ def mainLoop(self):
ParseErrorToken = tokenTypes["ParseError"]

for token in self.normalizedTokens():
prev_token = None
new_token = token
while new_token is not None:
prev_token = new_token
currentNode = self.tree.openElements[-1] if self.tree.openElements else None
currentNodeNamespace = currentNode.namespace if currentNode else None
currentNodeName = currentNode.name if currentNode else None
Expand DownExpand Up@@ -211,10 +213,10 @@ def mainLoop(self):
elif type == DoctypeToken:
new_token = phase.processDoctype(new_token)

if (type == StartTagToken andtoken["selfClosing"] and
nottoken["selfClosingAcknowledged"]):
if (type == StartTagToken andprev_token["selfClosing"] and
notprev_token["selfClosingAcknowledged"]):
self.parseError("non-void-element-with-trailing-solidus",
{"name":token["name"]})
{"name":prev_token["name"]})

# When the loop finishes it's EOF
reprocess = True
Expand DownExpand Up@@ -1933,6 +1935,7 @@ def processCharacters(self, token):
def startTagCol(self, token):
self.tree.insertElement(token)
self.tree.openElements.pop()
token["selfClosingAcknowledged"] = True

def startTagOther(self, token):
ignoreEndTag = self.ignoreEndTagColgroup()
Expand Down
6 changes: 6 additions & 0 deletionshtml5lib/tests/test_parser2.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -93,3 +93,9 @@ def test_debug_log():
def test_no_duplicate_clone():
frag = parseFragment("<b><em><foo><foob><fooc><aside></b></em>")
assert len(frag) == 2


def test_self_closing_col():
parser = HTMLParser()
parser.parseFragment('<table><colgroup><col /></colgroup></table>')
assert not parser.errors

[8]ページ先頭

©2009-2025 Movatter.jp