Skip to content

Commit 7e366ea

Browse files
committed
Bring back <time>
1 parent c5e1105 commit 7e366ea

File tree

6 files changed

+18
-8
lines changed

6 files changed

+18
-8
lines changed

jquery.microdata.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@
153153
return resolve(elm, 'data');
154154
case 'DATA':
155155
return this.attr('value') || '';
156+
case 'TIME':
157+
var datetime = elm.getAttribute('datetime');
158+
if (datetime != null)
159+
return datetime;
156160
default:
157161
return this.text();
158162
}

live/example/schemaorg-book

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ by <a itemprop="author" href="/author/jd_salinger.html">J.D. Salinger</a>
1919
Product details
2020
<span itemprop="numPages">224</span> pages
2121
Publisher: <span itemprop="publisher">Little, Brown, and Company</span> -
22-
<data itemprop="datePublished" value="1991-05-01">May 1, 1991</data>
22+
<time itemprop="publishDate" datetime="1991-05-01">May 1, 1991</time>
2323
Language: <span itemprop="inLanguage">English</span>
2424
ISBN-10: <span itemprop="isbn">0316769487</span>
2525

@@ -29,7 +29,7 @@ Reviews:
2929
<span itemprop="reviewRating">5</span> stars -
3030
<b>"<span itemprop="name">A masterpiece of literature</span>" </b>
3131
by <span itemprop="author">John Doe</span>,
32-
Written on <data itemprop="datePublished" value="2006-05-04">May 4, 2006</data>
32+
Written on <time itemprop="publishDate" datetime="2006-05-04">May 4, 2006</time>
3333
<span itemprop="reviewBody">I really enjoyed this book. It captures the essential
3434
challenge people face as they try make sense of their lives and grow to adulthood.</span>
3535
</div>
@@ -38,7 +38,7 @@ Reviews:
3838
<span itemprop="reviewRating">4</span> stars -
3939
<b>"<span itemprop="name">A good read.</span>" </b>
4040
by <span itemprop="author">Bob Smith</span>,
41-
Written on <data itemprop="datePublished" value="2006-06-15">June 15, 2006</data>
41+
Written on <time itemprop="publishDate" datetime="2006-06-15">June 15, 2006</time>
4242
<span itemprop="reviewBody">Catcher in the Rye is a fun book. It's a good book to read.</span>
4343
</div>
4444

live/example/schemaorg-product

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<div itemprop="reviews" itemscope itemtype="http://schema.org/Review">
2323
<span itemprop="name">Not a happy camper</span> -
2424
by <span itemprop="author">Ellie</span>,
25-
<data itemprop="datePublished" value="2011-04-01">April 1, 2011</data>
25+
<time itemprop="publishDate" datetime="2011-04-01">April 1, 2011</time>
2626
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
2727
<meta itemprop="worstRating" content="1">
2828
<span itemprop="ratingValue">1</span>/
@@ -34,7 +34,7 @@
3434
<div itemprop="reviews" itemscope itemtype="http://schema.org/Review">
3535
<span itemprop="name">Value purchase</span> -
3636
by <span itemprop="author">Lucas</span>,
37-
<data itemprop="datePublished" value="2011-03-25">March 25, 2011</data>
37+
<time itemprop="publishDate" datetime="2011-03-25">March 25, 2011</time>
3838
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
3939
<meta itemprop="worstRating" content="1">
4040
<span itemprop="ratingValue">4</span>/

live/example/vevent-bluesday

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
...
33
<h1 itemprop="summary">Bluesday Tuesday: Money Road</h1>
44
...
5-
<data itemprop="dtstart" value="2009-05-05T19:00:00Z">May 5th @ 7pm</data>
6-
(until <data itemprop="dtend" value="2009-05-05T21:00:00Z">9pm</data>)
5+
<time itemprop="dtstart" datetime="2009-05-05T19:00:00Z">May 5th @ 7pm</time>
6+
(until <time itemprop="dtend" datetime="2009-05-05T21:00:00Z">9pm</time>)
77
...
88
<a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
99
rel="bookmark" itemprop="url">Link to this page</a>

live/live.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function update(iframe, html) {
1111
$.each(['section', 'article', 'aside', 'data', 'hgroup', 'header', 'footer',
1212
'nav', 'figure', 'figcaption', 'video', 'audio', 'mark', 'progress',
1313
'meter', 'ruby', 'rt', 'rp', 'bdi', 'canvas', 'details', 'datalist',
14-
'output'],
14+
'output', 'time'],
1515
function(i, tagName) { doc.createElement(tagName); });
1616
// shrink iframe to max(150, height) (replace with <iframe seamless>?)
1717
$(iframe.contentWindow).load(function() {

test/jquery.microdata.unit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ test('data', function() {
176176
testStringReflection($('<data itemprop></data>'), 'value', 'itemValue', 'foo');
177177
});
178178

179+
test('time', function() {
180+
equal($('<time></time>').itemValue(), undefined);
181+
equal($('<time itemprop>now</time>').itemValue(), 'now');
182+
equal($('<time itemprop datetime="1984-09-03">then</time>').itemValue(), '1984-09-03');
183+
});
184+
179185
module('jQuery.microdata.json');
180186

181187
test('JSON extraction', function() {

0 commit comments

Comments
 (0)