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

Commit11ec09e

Browse files
committed
InSelectInTable
--HG--extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401112
1 parent1196895 commit11ec09e

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

‎src/html5lib/constants.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@
200200
u"Ignored."),
201201
"unexpected-end-tag-in-select":
202202
_(u"Unexpected end tag (%(name)s) in the select phase. Ignored."),
203+
"unexpected-table-element-start-tag-in-select-in-table":
204+
_(u"Unexpected table element start tag (%(name)s) in the select in table phase."),
205+
"unexpected-table-element-end-tag-in-select-in-table":
206+
_(u"Unexpected table element end tag (%(name)s) in the select in table phase."),
203207
"unexpected-char-after-body":
204208
_(u"Unexpected non-space characters in the after body phase."),
205209
"unexpected-start-tag-after-body":

‎src/html5lib/html5parser.py‎

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self, strict = False, tree=simpletree.TreeBuilder,
7171
"inRow":InRowPhase(self,self.tree),
7272
"inCell":InCellPhase(self,self.tree),
7373
"inSelect":InSelectPhase(self,self.tree),
74-
# XXX inSelectInTable
74+
"inSelectInTable":InSelectInTablePhase(self,self.tree),
7575
"afterBody":AfterBodyPhase(self,self.tree),
7676
"inFrameset":InFramesetPhase(self,self.tree),
7777
"afterFrameset":AfterFramesetPhase(self,self.tree),
@@ -977,7 +977,14 @@ def startTagCdata(self, name, attributes):
977977
defstartTagSelect(self,name,attributes):
978978
self.tree.reconstructActiveFormattingElements()
979979
self.tree.insertElement(name,attributes)
980-
self.parser.phase=self.parser.phases["inSelect"]
980+
ifself.parser.phasein (self.parser.phases["inTable"],
981+
self.parser.phases["inCaption"],
982+
self.parser.phases["inColumnGroup"],
983+
self.parser.phases["inTableBody"],self.parser.phases["inRow"],
984+
self.parser.phases["inCell"]):
985+
self.parser.phase=self.parser.phases["inSelectInTable"]
986+
else:
987+
self.parser.phase=self.parser.phases["inSelect"]
981988

982989
defstartTagMisplaced(self,name,attributes):
983990
""" Elements that should be children of other elements that have a
@@ -1876,6 +1883,41 @@ def endTagOther(self, name):
18761883
{"name":name})
18771884

18781885

1886+
classInSelectInTablePhase(Phase):
1887+
def__init__(self,parser,tree):
1888+
Phase.__init__(self,parser,tree)
1889+
1890+
self.startTagHandler=utils.MethodDispatcher([
1891+
(("caption","table","tbody","tfoot","thead","tr","td","th"),self.startTagTable)
1892+
])
1893+
self.startTagHandler.default=self.startTagOther
1894+
1895+
self.endTagHandler=utils.MethodDispatcher([
1896+
(("caption","table","tbody","tfoot","thead","tr","td","th"),self.endTagTable)
1897+
])
1898+
self.endTagHandler.default=self.endTagOther
1899+
1900+
defprocessCharacters(self,data):
1901+
self.parser.phases["inSelect"].processCharacters(data)
1902+
1903+
defstartTagTable(self,name,attributes):
1904+
self.parser.parseError("unexpected-table-element-start-tag-in-select-in-table", {"name":name})
1905+
self.endTagOther("select")
1906+
self.parser.phase.processStartTag(name,attributes)
1907+
1908+
defstartTagOther(self,name,attributes):
1909+
self.parser.phases["inSelect"].processStartTag(name,attributes)
1910+
1911+
defendTagTable(self,name):
1912+
self.parser.parseError("unexpected-table-element-end-tag-in-select-in-table", {"name":name})
1913+
ifself.tree.elementInScope(name):
1914+
self.endTagOther("select")
1915+
self.parser.phase.processEndTag(name)
1916+
1917+
defendTagOther(self,name):
1918+
self.parser.phases["inSelect"].processEndTag(name)
1919+
1920+
18791921
classAfterBodyPhase(Phase):
18801922
def__init__(self,parser,tree):
18811923
Phase.__init__(self,parser,tree)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp