UNPKG

mip-validator

Version:
369 lines (358 loc) 9.11 kB
{ "/.*/": { "attrs": { "style": { "disallow": true }, "/^on.+/": { "disallow": true } } }, "html": { "mandatory": true, "attrs": { "mip": { "mandatory": true } }, "duplicate": true }, "meta": { "duplicate": [{ "name": "/^viewport/" }, { "http-equiv": "/Content-Type/i" }, { "charset": "/^(UTF-8)/i" }], "attrs": { "content": [{ "match": { "name": "/^viewport/" }, "properties": { "width": "device-width", "initial-scale": "1" } }] }, "mandatory_or": [{ "http-equiv": "/Content-Type/i", "content": "/charset=(utf)|(UTF)-8/" }, { "charset": "/^(utf)|(UTF-8)/" }], "mandatory": { "name": "/^(viewport)?/", "content": "/((width|initial-scale)=.+){2}/" }, "mandatory_parent": "head" }, "link": { "mandatory": [{ "rel": "/^(miphtml)|(canonical)|(standardhtml)$/" }, { "rel": "/^stylesheet$/", "href": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|((https:)?\/\/mipcache.bdstatic.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/mipmain)/" }], "mandatory_parent": "head", "duplicate": [{ "rel": "/^(miphtml)|(standardhtml)$/" }, { "rel": "/^(miphtml)|(canonical)$/" }, { "rel": "/^stylesheet$/", "href": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|(c.mipcdn.com\/static\/mipmain)/" }], "attrs": { "href": [{ "value": "/^(http(s)?:)?\/\//", "match": { "rel": "/^(miphtml)|(canonical)|(standardhtml)$/" } }, { "value": "/^(?!\/[^\/])/", "match": { "rel": "/^(?!(miphtml)|(canonical)|(standardhtml))$/" } }] } }, "script": [ { "mandatory": { "type": "/^(text\/javascript)?/", "src": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|((https:)?\/\/mipcache.bdstatic.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/mipmain)/" } }, { "match": { "src": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|((https:)?\/\/mipcache.bdstatic.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/mipmain)/" }, "attrs": { "type": { "value": "/^(text\/javascript)$/" } } }, { "match_ancestor": "head", "match": { "src": "/^(https:)?\/\/(mipcache.bdstatic.com\/static\/mipmain)|(m.baidu.com\/static\/ala\/sf\/static\/)|((https:)?\/\/mipcache.bdstatic.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/v\\d\/)|((https:)?\/\/c.mipcdn.com\/static\/mipmain)/" }, "attrs": { "async": { "mandatory": true } } }, { "disallow": true, "match": { "type": "/^(?!application\/(ld\\+)?json)/", "src":"/^(?!((https:)?\/\/mipcache.bdstatic.com)|((https:)?\/\/m.baidu.com\/static\/ala\/sf\/static\/)|((https:)?\/\/c.mipcdn.com))/" } }, { "disallowed_ancestor": "template" }], "mip-input": { "mandatory_ancestor": "mip-form", "attrs": { "name": { "mandatory": true } } }, "img": { "disallow": true }, "video": { "disallow": true }, "audio": { "disallow": true }, "frame": { "disallow": true }, "frameset": { "disallow": true }, "object": { "disallow": true }, "param": { "disallow": true }, "applet": { "disallow": true }, "embed": { "disallow": true }, "form": { "disallow": true }, "iframe": { "disallow": true }, "input": { "mandatory_ancestor": "mip-form" }, "textarea": { "mandatory_ancestor": "mip-form" }, "select": { "mandatory_ancestor": "mip-form" }, "option": { "mandatory_ancestor": "mip-form" }, "a": { "attrs": { "href": { "mandatory": true, "value": "/^((?!javascript:).*)$/" } } }, "mip-img": { "attrs": { "src": { "mandatory": true, "value": "/^.+\\S/" }, "srcset": { "value": "/^.+\\S/" } } }, "mip-pix": { "attrs": { "src": { "mandatory": true, "value": "/^((https:)?\/\/)|(http:\/\/*\\?)/" } } }, "mip-video": { "attrs": { "src": { "mandatory": true, "nomatch_descendant": "source" } } }, "source": { "mandatory_ancestor": "mip-video", "attrs": { "src": { "mandatory": true, "value": "/^(?!\/[^\/])/" } } }, "mip-carousel": { "attrs": { "width": { "mandatory": true, "value": "/^\\d{1,4}$/" }, "height": { "mandatory": true, "value": "/^\\d{1,4}$/" } } }, "mip-iframe": { "attrs": { "width": { "mandatory": true, "value": "/^\\d{1,4}$/" }, "height": { "mandatory": true, "value": "/^\\d{1,4}$/" } } }, "mip-appdl": { "attrs": { "tpl": { "mandatory": true, "value": "/^(noneImg)|(imageText)$/" }, "src": { "mandatory": true, "value": "/^http(s)?:\/\//", "match": { "tpl": "imageText" } }, "texttip": { "mandatory": true, "value": "/^\\S+$/" } } }, "mip-audio": { "attrs": { "src": { "mandatory": true, "value": "/^(?!\/[^\/])/" } } }, "mip-stats-bidu": { "attrs": { "token": { "mandatory": true, "value": "/^\\S+$/" } } }, "mip-form": { "attrs": { "method": { "value": "/^(post)|(get)$/i" }, "url": { "mandatory": true, "value": "/^(http(s)?:)?\/\//" } } }, "mip-link": { "attrs": { "href": { "mandatory": true, "value": "/^((?!javascript:).*)$/" } } }, "mip-ad": { "attrs": { "type": { "mandatory": true } } }, "mip-embed": { "attrs": { "type": { "mandatory": true } } }, "head": { "duplicate": true, "mandatory": true, "mandatory_parent": "html" }, "body": { "mandatory": true, "mandatory_parent": "html", "duplicate": true }, "style": { "attrs": { "mip-custom": { "mandatory": true } }, "duplicate": true, "mandatory_parent": "head" }, "template": { "attrs": { "type": { "mandatory": true } } }, "base": { "attrs": { "target": { "value": "/^(^_top$)|(^_self$)|(^_blank$)$/i" }, "href": { "value": "/^\/$/" } } }, "mip-vd-baidu": { "attrs": { "src": { "mandatory": true, "value": "/^(http(s)?:)?\/\//" }, "title": { "mandatory": true, "value": "/^\\S+$/" }, "poster": { "mandatory": true, "value": "/^\\S+$/" } } } }