Microsoft/TypeScript

`HTMLMetaElement` property descriptions

Open

#48.451 aberto em 27 de mar. de 2022

Ver no GitHub
 (5 comments) (0 reactions) (0 assignees)TypeScript (6.726 forks)batch import
BugDomain: lib.d.tsHelp Wanted

Métricas do repositório

Stars
 (48.455 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)

Description

lib Update Request

Configuration Check

I'm using VS-Code with Typescript Version 4.7.0-dev.20220323 installed in local repo.

Missing / Incorrect Descriptions

HTMLMetaElement properties:

  • name
  • content
  • httpEquiv
  • media

Sample Code

<!DOCTYPE html>
<html lang="en">

<head>
	<!-- meta tags for social media-->
	<meta	name="title"	content="blabla">
	…
</head>

<body>
	…
</body>

</html>
/**
 * `getElementsByTagName` returns a {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection HTMLCollection},\
 * which is an `Array-like` object similar to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments arguments},\
 * therefore we need to convert it to a real {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array Array},\
 * containing {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement HTMLMetaElement}'s,\
 * to be able to use Array-Methods on it.
 */
const	metaTitle =	[...document.head.getElementsByTagName('meta')]
			.find(meta => meta.name === 'title')
	,origTitle =	metaTitle?.content

document.title = metaTitle ? `${origTitle}${extraText}` : 'someOtherText'

In VS-Code hover-over the name/content properties in above code.

  • name It should display something similar to: Gets or sets the value of the name property of the element.
  • content It should display something similar to: Gets or sets the value of the content property of the element.
  • The other mentioned properties have similar issues.

Documentation Link

Guia do colaborador