MCPcopy
hub / github.com/angular/angular / updateTag

Method updateTag

packages/platform-browser/src/browser/meta.ts:134–142  ·  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

132 * @return The modified element.
133 */
134 updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null {
135 if (!tag) return null;
136 selector = selector || this._parseSelector(tag);
137 const meta: HTMLMetaElement = this.getTag(selector)!;
138 if (meta) {
139 return this._setMetaElementAttributes(tag, meta);
140 }
141 return this._getOrCreateElement(tag, true);
142 }
143
144 /**
145 * Removes an existing `<meta>` tag element from the current HTML document.

Callers 2

meta_spec.tsFile · 0.80
updateTitleMethod · 0.80

Calls 4

_parseSelectorMethod · 0.95
getTagMethod · 0.95
_getOrCreateElementMethod · 0.95

Tested by

no test coverage detected