(
lcTag: string,
lcName: string,
namespaceURI: string | null,
value: string
)
| 2240 | * @return the value, wrapped when Trusted Types demand it |
| 2241 | */ |
| 2242 | const _applyTrustedTypesToAttribute = function ( |
| 2243 | lcTag: string, |
| 2244 | lcName: string, |
| 2245 | namespaceURI: string | null, |
| 2246 | value: string |
| 2247 | ): string { |
| 2248 | if ( |
| 2249 | trustedTypesPolicy && |
| 2250 | typeof trustedTypes === 'object' && |
| 2251 | typeof trustedTypes.getAttributeType === 'function' && |
| 2252 | !namespaceURI |
| 2253 | ) { |
| 2254 | switch (trustedTypes.getAttributeType(lcTag, lcName)) { |
| 2255 | case 'TrustedHTML': { |
| 2256 | return _createTrustedHTML(value); |
| 2257 | } |
| 2258 | |
| 2259 | case 'TrustedScriptURL': { |
| 2260 | return _createTrustedScriptURL(value); |
| 2261 | } |
| 2262 | |
| 2263 | default: { |
| 2264 | break; |
| 2265 | } |
| 2266 | } |
| 2267 | } |
| 2268 | |
| 2269 | return value; |
| 2270 | }; |
| 2271 | |
| 2272 | /** |
| 2273 | * Write a modified attribute value back onto the element. On |
no test coverage detected