|
213 | 213 | return $(props);
|
214 | 214 | }
|
215 | 215 |
|
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 |
| - |
219 | 216 | $.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 () { |
229 | 219 | return this[0].getAttribute('itemscope') != null;
|
230 | 220 | },
|
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 () { |
237 | 223 | return resolve(this[0], 'itemid');
|
238 | 224 | },
|
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 |
251 | 229 | });
|
252 | 230 | })();
|
0 commit comments