(fragment)
| 304 | * @visibleForTesting |
| 305 | */ |
| 306 | export function parseFragment(fragment) { |
| 307 | try { |
| 308 | let json = fragment.substr(1); |
| 309 | // Some browser, notably Firefox produce an encoded version of the fragment |
| 310 | // while most don't. Since we know how the string should start, this is easy |
| 311 | // to detect. |
| 312 | if (json.startsWith('{%22')) { |
| 313 | json = decodeURIComponent(json); |
| 314 | } |
| 315 | return /** @type {!JsonObject} */ (json ? parseJson(json) : {}); |
| 316 | } catch (err) { |
| 317 | return null; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * Not all types of embeds are allowed to be used with all tag names on the |
no test coverage detected