Microsoft/TypeScript

`HTMLMetaElement` property descriptions

Open

#48,451 opened on 2022年3月27日

GitHub で見る
 (5 comments) (0 reactions) (0 assignees)TypeScript (6,726 forks)batch import
BugDomain: lib.d.tsHelp Wanted

Repository metrics

Stars
 (48,455 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 9 merged PRs)

説明

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

コントリビューターガイド