mip-validator
Version:
367 lines (363 loc) • 8.71 kB
JSON
{
"/.*/": {
"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-8/i"
}, {
"charset": "/^utf-8$/i"
}],
"mandatory": {
"name": "/^(viewport)?/",
"content": "/((width|initial-scale)=.+){2}/"
},
"mandatory_parent": "head"
},
"link": {
"mandatory": [{
"rel": "/^(miphtml)|(canonical)$/"
}, {
"rel": "/^stylesheet$/",
"href": "/^(https:)?\/\/((mipcache\\.bdstatic\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css)|(mipcache\\.bdstatic\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/v\\d\/mip\\.css)|(c\\.mipcdn\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.css))$/"
}],
"mandatory_parent": "head",
"duplicate": [{
"rel": "/^(miphtml)|(canonical)$/"
}],
"attrs": {
"href": [{
"value": "/^(http(s)?:)?\/\//",
"match": {
"rel": "/^((canonical)|(miphtml))$/"
}
}, {
"value": "/^(?!\/[^\/])/",
"match": {
"rel": "/^(?!((miphtml)|(canonical))$)/"
}
}]
}
},
"script": [
{
"mandatory": {
"src": "/^(https:)?\/\/((mipcache\\.bdstatic\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.js)|(mipcache\\.bdstatic\\.com\/static\/v\\d\/mip\\.js)|(c\\.mipcdn\\.com\/static\/v\\d\/mip\\.js)|(c\\.mipcdn\\.com\/static\/mipmain-v\\d\\.\\d\\.\\d\\.js))$/"
}
},
{
"match": {
"src": "/^(https:)?\/\/((mipcache\\.bdstatic\\.com)|(c\\.mipcdn\\.com))(\/([\\s\\S]*))?$/"
},
"attrs": {
"type": {
"value": "/^(((application)|(text))\/javascript)$/"
}
}
}, {
"match_ancestor": "head",
"match": {
"src": "/^(https:)?\/\/((mipcache\\.bdstatic\\.com)|(c\\.mipcdn\\.com))(\/([\\s\\S]*))?$/"
},
"attrs": {
"async": {
"mandatory": true
}
}
}, {
"disallow": true,
"match": {
"type": "/^(?!application\/(ld\\+)?json$)/",
"src":"/^(?!((https:)?\/\/((mipcache\\.bdstatic\\.com)|(c\\.mipcdn\\.com))(\/([\\s\\S]*))?$))/"
}
}, {
"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_or": [{
"src": "/^\\S+$/"
}, {
"srcset": "/^\\S+$/"
}],
"attrs": {
"src": {
"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": "/picture|mip-video|mip-audio/",
"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": {
"duplicate": true,
"mandatory_parent": "head",
"attrs_or": [{
"target": "/^((_top)|(_self)|(_blank))$/i"
}, {
"href": "/^\/$/"
}],
"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+$/"
}
}
}
}