(attrName: string, tagName?: string)
| 1003 | } |
| 1004 | |
| 1005 | function i18nResolveSanitizer(attrName: string, tagName?: string): SanitizerFn | null { |
| 1006 | let schemaContext: SecurityContext; |
| 1007 | |
| 1008 | if (tagName) { |
| 1009 | const [ns, name] = splitNsName(tagName, false); |
| 1010 | schemaContext = checkSecurityContext(name, attrName, ns); |
| 1011 | } else { |
| 1012 | schemaContext = checkSecurityContext('*', attrName); |
| 1013 | } |
| 1014 | |
| 1015 | switch (schemaContext) { |
| 1016 | case SecurityContext.HTML: |
| 1017 | return _sanitizeHtml; |
| 1018 | case SecurityContext.STYLE: |
| 1019 | return _sanitizeStyle; |
| 1020 | case SecurityContext.SCRIPT: |
| 1021 | return _sanitizeScript; |
| 1022 | case SecurityContext.URL: |
| 1023 | return _sanitizeUrl; |
| 1024 | case SecurityContext.RESOURCE_URL: |
| 1025 | return _sanitizeResourceUrl; |
| 1026 | case SecurityContext.ATTRIBUTE_NO_BINDING: |
| 1027 | return _validateAttribute; |
| 1028 | default: |
| 1029 | return null; |
| 1030 | } |
| 1031 | } |
no test coverage detected
searching dependent graphs…