Skip to content

Commit f9edde6

Browse files
committed
Drop feature-detection; always use the same code path
1 parent 7e366ea commit f9edde6

File tree

1 file changed

+8
-30
lines changed

1 file changed

+8
-30
lines changed

jquery.microdata.js

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -213,40 +213,18 @@
213213
return $(props);
214214
}
215215

216-
// feature detection to use native support where available
217-
var t = $('<data itemscope itemtype="type" itemid="id" itemprop="prop" itemref="ref" value="value">')[0];
218-
219216
$.fn.extend({
220-
items: document.getItems && t.itemType && t.itemType.contains ? function(types) {
221-
var doc = this[0];
222-
if (doc.getItems)
223-
return $(types ? doc.getItems(types) : doc.getItems());
224-
return getItems.call(this, types);
225-
} : getItems,
226-
itemScope: t.itemScope ? function() {
227-
return this[0].itemScope;
228-
} : function () {
217+
items: getItems,
218+
itemScope: function () {
229219
return this[0].getAttribute('itemscope') != null;
230220
},
231-
itemType: t.itemType && t.itemType.contains ? function() {
232-
return this[0].itemType;
233-
} : tokenList('itemtype'),
234-
itemId: t.itemId == 'id' ? function() {
235-
return this[0].itemId;
236-
} : function () {
221+
itemType: tokenList('itemtype'),
222+
itemId: function () {
237223
return resolve(this[0], 'itemid');
238224
},
239-
itemProp: t.itemProp && t.itemProp.contains ? function() {
240-
return this[0].itemProp;
241-
} : tokenList('itemprop'),
242-
itemRef: t.itemRef && t.itemRef.contains ? function() {
243-
return this[0].itemRef;
244-
} : tokenList('itemref'),
245-
itemValue: t.itemValue == t && t.value == 'value' ? function() {
246-
return this[0].itemValue;
247-
} : itemValue,
248-
properties: t.properties && t.properties.namedItem ? function(name) {
249-
return $(name ? this[0].properties.namedItem(name) : this[0].properties);
250-
} : properties
225+
itemProp: tokenList('itemprop'),
226+
itemRef: tokenList('itemref'),
227+
itemValue: itemValue,
228+
properties: properties
251229
});
252230
})();

0 commit comments

Comments
 (0)