Meta

A service that can be used to get and add meta tags.

      
      class Meta {
  addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | null
  addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[]
  getTag(attrSelector: string): HTMLMetaElement | null
  getTags(attrSelector: string): HTMLMetaElement[]
  updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null
  removeTag(attrSelector: string): void
  removeTagElement(meta: HTMLMetaElement): void
}
    

方法

addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | null
      
      addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | null
    
参数
tag MetaDefinition
forceCreation boolean

可选. 默认值是 false.

返回值

HTMLMetaElement | null

addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[]
      
      addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[]
    
参数
tags MetaDefinition[]
forceCreation boolean

可选. 默认值是 false.

返回值

HTMLMetaElement[]

getTag(attrSelector: string): HTMLMetaElement | null
      
      getTag(attrSelector: string): HTMLMetaElement | null
    
参数
attrSelector string
返回值

HTMLMetaElement | null

getTags(attrSelector: string): HTMLMetaElement[]
      
      getTags(attrSelector: string): HTMLMetaElement[]
    
参数
attrSelector string
返回值

HTMLMetaElement[]

updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null
      
      updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null
    
参数
tag MetaDefinition
selector string

可选. 默认值是 undefined.

返回值

HTMLMetaElement | null

removeTag(attrSelector: string): void
      
      removeTag(attrSelector: string): void
    
参数
attrSelector string
返回值

void

removeTagElement(meta: HTMLMetaElement): void
      
      removeTagElement(meta: HTMLMetaElement): void
    
参数
meta HTMLMetaElement
返回值

void