šŸ“Š HTML
Q. Which of the following is true if the property value of a name-value pair added by an element with an itemprop attribute is a meta element ?
  • (A) The value is the item created by the element.
  • (B) The value is the value of the element’s value attribute, if it has one, or the empty string otherwise
  • (C) On getting, if the element has a datetime content attribute, the IDL attribute must return that content attribute’s value
  • (D) The value is the element’s textContent.
šŸ’¬ Discuss
āœ… Correct Answer: (B) The value is the value of the element’s value attribute, if it has one, or the empty string otherwise

Explanation:

In HTML5 Microdata, when an element has an itemprop attribute, it is used to define a name-value pair for metadata.

If the element is a <meta> element, its value is taken from the content attribute, or it defaults to an empty string if content is not specified.

Example:

<div itemscope itemtype="https://schema.org/Book">
<meta itemprop="name" content="The Great Gatsby">
</div>
  • Here, "The Great Gatsby" is the value for name because the <meta> element provides it using the content attribute.

Why Other Options Are Incorrect?

(A) The value is the item created by the element. āŒ

  • This is true for elements like <div> or <span>, but not for <meta>. <meta> doesn't create an item; it just stores a value.

(C) On getting, if the element has a datetime content attribute, the IDL attribute must return that content attribute’s value. āŒ

  • This applies to <time> elements, not <meta>.

(D) The value is the element’s textContent. āŒ

  • <meta> elements don’t have visible text content, so this doesn't apply.

Final Answer:

āœ… (B) The value is the value of the element’s value attribute, if it has one, or the empty string otherwise.

Explanation by: Official MCQ Buddy

In HTML5 Microdata, when an element has an itemprop attribute, it is used to define a name-value pair for metadata.

If the element is a <meta> element, its value is taken from the content attribute, or it defaults to an empty string if content is not specified.

Example:

<div itemscope itemtype="https://schema.org/Book">
<meta itemprop="name" content="The Great Gatsby">
</div>
  • Here, "The Great Gatsby" is the value for name because the <meta> element provides it using the content attribute.

Why Other Options Are Incorrect?

(A) The value is the item created by the element. āŒ

  • This is true for elements like <div> or <span>, but not for <meta>. <meta> doesn't create an item; it just stores a value.

(C) On getting, if the element has a datetime content attribute, the IDL attribute must return that content attribute’s value. āŒ

  • This applies to <time> elements, not <meta>.

(D) The value is the element’s textContent. āŒ

  • <meta> elements don’t have visible text content, so this doesn't apply.

Final Answer:

āœ… (B) The value is the value of the element’s value attribute, if it has one, or the empty string otherwise.

šŸ’¬ Discussion


šŸ“Š Question Analytics

šŸ‘ļø
230
Total Visits
šŸ“½ļø
4 y ago
Published
šŸŽ–ļø
Harikesh
Publisher
šŸ“ˆ
83%
Success Rate