|
62 | 62 | _(u"Value must be an integer: '%(attributeName)s' attribute on <%tagName)s>."),
|
63 | 63 | "invalid-root-namespace":
|
64 | 64 | _(u"Root namespace must be 'http://www.w3.org/1999/xhtml', or omitted."),
|
| 65 | +"invalid-browsing-context": |
| 66 | +_(u"Value must be one of ('_self', '_parent', '_top'), or a name that does not start with '_': '%(attributeName)s' attribute on <%(tagName)s>."), |
65 | 67 | })
|
66 | 68 |
|
67 | 69 | globalAttributes=frozenset(('class','contenteditable','contextmenu','dir',
|
@@ -402,13 +404,28 @@ def validateAttributeValueId(self, token, tagName, attrName, attrValue):
|
402 | 404 | defvalidateAttributeValueTabindex(self,token,tagName,attrName,attrValue):
|
403 | 405 | fortinself.checkIntegerValue(token,tagName,attrName,attrValue)or []:yieldt
|
404 | 406 |
|
| 407 | +defvalidateAttributeValueRef(self,token,tagName,attrName,attrValue): |
| 408 | +# XXX |
| 409 | +pass |
| 410 | + |
| 411 | +defvalidateAttributeValueTemplate(self,token,tagName,attrName,attrValue): |
| 412 | +# XXX |
| 413 | +pass |
| 414 | + |
405 | 415 | defvalidateAttributeValueHtmlXmlns(self,token,tagName,attrName,attrValue):
|
406 | 416 | ifattrValue!="http://www.w3.org/1999/xhtml":
|
407 | 417 | yield {"type":"ParseError",
|
408 | 418 | "data":"invalid-root-namespace",
|
409 | 419 | "datavars": {"tagName":tagName,
|
410 | 420 | "attributeName":attrName}}
|
411 | 421 |
|
| 422 | +defvalidateAttributeValueBaseHref(self,token,tagName,attrName,attrValue): |
| 423 | +# XXX |
| 424 | +pass |
| 425 | + |
| 426 | +defvalidateAttributeValueBaseTarget(self,token,tagName,attrName,attrValue): |
| 427 | +fortinself.checkBrowsingContext(token,tagName,attrName,attrValue)or []:yieldt |
| 428 | + |
412 | 429 | ##########################################################################
|
413 | 430 | # Attribute validation helpers
|
414 | 431 | ##########################################################################
|
@@ -525,6 +542,16 @@ def checkIntegerValue(self, token, tagName, attrName, attrValue):
|
525 | 542 | "datavars": {"tagName":tagName,
|
526 | 543 | "attributeName":attrName}}
|
527 | 544 |
|
| 545 | +defcheckBrowsingContext(self,token,tagName,attrName,attrValue): |
| 546 | +ifnotattrValue:return |
| 547 | +ifattrValue[0]!='_':return |
| 548 | +attrValue=attrValue.lower() |
| 549 | +ifattrValueinfrozenset(('_self','_parent','_top','_blank')):return |
| 550 | +yield {"type":"ParseError", |
| 551 | +"data":"invalid-browsing-context", |
| 552 | +"datavars": {"tagName":tagName, |
| 553 | +"attributeName":attrName}} |
| 554 | + |
528 | 555 | ##########################################################################
|
529 | 556 | # Whole document validation (IDs, etc.)
|
530 | 557 | ##########################################################################
|
|