* Initializes (if necessary) cached map of an ampdoc's meta name values to * their associated content values and returns the map. * @return {!{[key: string]: string}}
()
| 350 | * @return {!{[key: string]: string}} |
| 351 | */ |
| 352 | getMeta() { |
| 353 | if (this.meta_) { |
| 354 | return map(this.meta_); |
| 355 | } |
| 356 | |
| 357 | this.meta_ = map(); |
| 358 | const metaEls = dev() |
| 359 | .assertElement(this.win.document.head) |
| 360 | .querySelectorAll('meta[name]'); |
| 361 | metaEls.forEach((metaEl) => { |
| 362 | const name = metaEl.getAttribute('name'); |
| 363 | const content = metaEl.getAttribute('content'); |
| 364 | if (!name || content === null) { |
| 365 | return; |
| 366 | } |
| 367 | |
| 368 | // Retain only the first meta content value for a given name |
| 369 | if (this.meta_[name] === undefined) { |
| 370 | this.meta_[name] = content; |
| 371 | } |
| 372 | }); |
| 373 | return map(this.meta_); |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * Returns the value of an ampdoc's meta tag content for a given name, or |
no test coverage detected