(attrName: string, tagName?: string)
| 1010 | } |
| 1011 | |
| 1012 | function i18nResolveSanitizer(attrName: string, tagName?: string): SanitizerFn | null { |
| 1013 | let schemaContext: SecurityContext; |
| 1014 | |
| 1015 | if (tagName) { |
| 1016 | const [ns, name] = splitNsName(tagName, false); |
| 1017 | schemaContext = checkSecurityContext(name, attrName, ns); |
| 1018 | } else { |
| 1019 | schemaContext = checkSecurityContext('*', attrName); |
| 1020 | } |
| 1021 | |
| 1022 | switch (schemaContext) { |
| 1023 | case SecurityContext.HTML: |
| 1024 | return _sanitizeHtml; |
| 1025 | case SecurityContext.STYLE: |
| 1026 | return _sanitizeStyle; |
| 1027 | case SecurityContext.SCRIPT: |
| 1028 | return _sanitizeScript; |
| 1029 | case SecurityContext.URL: |
| 1030 | return _sanitizeUrl; |
| 1031 | case SecurityContext.RESOURCE_URL: |
| 1032 | return _sanitizeResourceUrl; |
| 1033 | case SecurityContext.ATTRIBUTE_NO_BINDING: |
| 1034 | return _validateAttribute; |
| 1035 | default: |
| 1036 | return null; |
| 1037 | } |
| 1038 | } |
| 1039 | |
| 1040 | /** |
| 1041 | * Whether an attribute name uses an Angular binding syntax (`[prop]`, `(event)`, `*structural`, |
no test coverage detected