MCPcopy Create free account
hub / github.com/angular/angular / updateTag

Method updateTag

packages/platform-browser/src/browser/meta.ts:128–137  ·  view source on GitHub ↗

* Modifies an existing ` ` tag element in the current HTML document. * @param tag The tag description with which to replace the existing tag content. * @param selector A tag attribute and value to match against, to identify * an existing tag. A string in the format `"tag_attribute=`val

(tag: MetaDefinition, selector?: string)

Source from the content-addressed store, hash-verified

126 * @return The modified element.
127 */
128 updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null {
129 validateMetaDefinition(tag);
130 selector ??= parseSelector(tag);
131 const meta = this.getTag(selector);
132 if (meta) {
133 setMetaElementAttributes(tag, meta);
134 return meta;
135 }
136 return this._getOrCreateElement(tag, true);
137 }
138
139 /**
140 * Removes an existing `<meta>` tag element from the current HTML document.

Callers 2

meta_spec.tsFile · 0.80
updateTitleMethod · 0.80

Calls 5

getTagMethod · 0.95
_getOrCreateElementMethod · 0.95
validateMetaDefinitionFunction · 0.85
parseSelectorFunction · 0.85
setMetaElementAttributesFunction · 0.85

Tested by

no test coverage detected