mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #6053 from overleaf/ta-pdf-detach-tests
PDF Detach Misc Tests GitOrigin-RevId: 9615c8fdfd8964a9c63d7c91e4596d397a1d35dc
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import _ from 'lodash'
|
||||
|
||||
// cache for parsed values
|
||||
const cache = new Map()
|
||||
window.metaAttributesCache = window.metaAttributesCache || new Map()
|
||||
|
||||
export default function getMeta(name, fallback) {
|
||||
if (cache.has(name)) return cache.get(name)
|
||||
if (window.metaAttributesCache.has(name)) {
|
||||
return window.metaAttributesCache.get(name)
|
||||
}
|
||||
const element = document.head.querySelector(`meta[name="${name}"]`)
|
||||
if (!element) {
|
||||
return fallback
|
||||
@@ -28,7 +30,7 @@ export default function getMeta(name, fallback) {
|
||||
default:
|
||||
value = plainTextValue
|
||||
}
|
||||
cache.set(name, value)
|
||||
window.metaAttributesCache.set(name, value)
|
||||
return value
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user