(attrName: string, tagName?: string)
| 984 | } |
| 985 | |
| 986 | function i18nResolveSanitizer(attrName: string, tagName?: string): SanitizerFn | null { |
| 987 | let schemaContext: SecurityContext; |
| 988 | |
| 989 | if (tagName) { |
| 990 | const [ns, name] = splitNsName(tagName, false); |
| 991 | schemaContext = checkSecurityContext(name, attrName, ns); |
| 992 | } else { |
| 993 | schemaContext = checkSecurityContext('*', attrName); |
| 994 | } |
| 995 | |
| 996 | switch (schemaContext) { |
| 997 | case SecurityContext.HTML: |
| 998 | return _sanitizeHtml; |
| 999 | case SecurityContext.STYLE: |
| 1000 | return _sanitizeStyle; |
| 1001 | case SecurityContext.SCRIPT: |
| 1002 | return _sanitizeScript; |
| 1003 | case SecurityContext.URL: |
| 1004 | return _sanitizeUrl; |
| 1005 | case SecurityContext.RESOURCE_URL: |
| 1006 | return _sanitizeResourceUrl; |
| 1007 | case SecurityContext.ATTRIBUTE_NO_BINDING: |
| 1008 | return _validateAttribute; |
| 1009 | default: |
| 1010 | return null; |
| 1011 | } |
| 1012 | } |
no test coverage detected