From cc913cbeed8c061b739b0d01c39832c57685347a Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 19 Aug 2011 07:00:22 +0000 Subject: [PATCH] Inline id getter --- chrome/content/zotero/xpcom/data/item.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index c0ce933ab..73f4829d2 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -91,7 +91,12 @@ Zotero.Item.prototype._init = function () { Zotero.Item.prototype.__defineGetter__('objectType', function () { return 'item'; }); -Zotero.Item.prototype.__defineGetter__('id', function () { return this.getField('id'); }); +Zotero.Item.prototype.__defineGetter__('id', function () { + if(!this._id && this._key && !this._primaryDataLoaded) { + this.loadPrimaryData(true); + } + return this._id; +}); Zotero.Item.prototype.__defineGetter__('itemID', function () { Zotero.debug("Item.itemID is deprecated -- use Item.id"); return this.id;