|
11 | 11 | # from "leaking" into tables, object elements, and marquees. |
12 | 12 | Marker=None |
13 | 13 |
|
| 14 | +listElementsMap= { |
| 15 | +None:(frozenset(scopingElements),False), |
| 16 | +"button":(frozenset(scopingElements|set([(namespaces["html"],"button")])),False), |
| 17 | +"list":(frozenset(scopingElements|set([(namespaces["html"],"ol"), |
| 18 | + (namespaces["html"],"ul")])),False), |
| 19 | +"table":(frozenset([(namespaces["html"],"html"), |
| 20 | + (namespaces["html"],"table")]),False), |
| 21 | +"select":(frozenset([(namespaces["html"],"optgroup"), |
| 22 | + (namespaces["html"],"option")]),True) |
| 23 | + } |
| 24 | + |
| 25 | + |
14 | 26 | classNode(object): |
15 | 27 | def__init__(self,name): |
16 | 28 | """Node representing an item in the tree. |
@@ -157,16 +169,6 @@ def elementInScope(self, target, variant=None): |
157 | 169 | #match any node with that name |
158 | 170 | exactNode=hasattr(target,"nameTuple") |
159 | 171 |
|
160 | | -listElementsMap= { |
161 | | -None:(scopingElements,False), |
162 | | -"button":(scopingElements|set([(namespaces["html"],"button")]),False), |
163 | | -"list":(scopingElements|set([(namespaces["html"],"ol"), |
164 | | - (namespaces["html"],"ul")]),False), |
165 | | -"table":(set([(namespaces["html"],"html"), |
166 | | - (namespaces["html"],"table")]),False), |
167 | | -"select":(set([(namespaces["html"],"optgroup"), |
168 | | - (namespaces["html"],"option")]),True) |
169 | | - } |
170 | 172 | listElements,invert=listElementsMap[variant] |
171 | 173 |
|
172 | 174 | fornodeinreversed(self.openElements): |
|