-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Microdata are a strange set of attributes which are ONLY defined in markup, and have no relationship to the underlying Document Object Model node. As such programmatically defining an element and setting a property on it with a given Microdata attribute will not work: https://codepen.io/iambrosius/full/jOvXBBG One can read more about microdata here: https://developer.mozilla.org/en-US/docs/Web/HTML/Microdata The fix is to remove itemscope being a boolean attribute, because that opts into a transformation as a DOM property, which is wrong.
- Loading branch information
1 parent
b8959ac
commit 1333be0
Showing
8 changed files
with
71 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ const _boolean_attributes = [ | |
'hidden', | ||
'inert', | ||
'ismap', | ||
'itemscope', | ||
'loop', | ||
'multiple', | ||
'muted', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default { | ||
props: { | ||
hidden: true | ||
}, | ||
html: '<div hidden />', | ||
test({ assert, component, target }) { | ||
component.hidden = false; | ||
assert.htmlEqual(target.innerHTML, '<div />'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<script> | ||
export let hidden = false; | ||
</script> | ||
|
||
<div {hidden} /> |
11 changes: 0 additions & 11 deletions
11
test/runtime/samples/attribute-boolean-itemscope/_config.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// There is no relationship between the attribute and the dom node with regards to microdata attributes https://developer.mozilla.org/en-US/docs/Web/HTML/Microdata | ||
export default { | ||
html: `<div itemscope itemtype="https://schema.org/SoftwareApplication"> | ||
<span itemprop="name">Game</span> - REQUIRES | ||
<span itemprop="operatingSystem">OS</span><br/> | ||
<link itemprop="applicationCategory" href="https://schema.org/GameApplication"/> | ||
<div itemprop="aggregateRating" itemscope="" itemtype="https://schema.org/AggregateRating">RATING: | ||
<span itemprop="ratingValue">4.6</span> ( | ||
<span itemprop="ratingCount">8864</span> ratings )</div> | ||
<div itemref="offers"></div> | ||
</div> | ||
<div | ||
itemprop="offers" | ||
itemid="offers" | ||
id="offers" | ||
itemscope | ||
itemtype="https://schema.org/Offer" | ||
> | ||
Price: $<span itemprop="price">1.00</span> | ||
<meta itemprop="priceCurrency" content="USD"/> | ||
</div> | ||
` | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!-- Example from https://developer.mozilla.org/en-US/docs/Web/HTML/Microdata --> | ||
<div itemscope itemtype="https://schema.org/SoftwareApplication"> | ||
<span itemprop="name">Game</span> - REQUIRES | ||
<span itemprop="operatingSystem">OS</span><br /> | ||
<link | ||
itemprop="applicationCategory" | ||
href="https://schema.org/GameApplication" | ||
/> | ||
|
||
<div | ||
itemprop="aggregateRating" | ||
itemscope | ||
itemtype="https://schema.org/AggregateRating" | ||
> | ||
RATING: | ||
<span itemprop="ratingValue">4.6</span> ( | ||
<span itemprop="ratingCount">8864</span> ratings ) | ||
</div> | ||
<div itemref="offers" /> | ||
</div> | ||
|
||
<div | ||
itemprop="offers" | ||
itemid="offers" | ||
id="offers" | ||
itemscope | ||
itemtype="https://schema.org/Offer" | ||
> | ||
Price: $<span itemprop="price">1.00</span> | ||
<meta itemprop="priceCurrency" content="USD" /> | ||
</div> |