commit b63886d37d13fb80d775de26749374428ccad992
parent 73dd60f2c1ba430a6b0f2919e4739273aff37fd4
Author: Simon Kornblith <simon@simonster.com>
Date: Thu, 6 Dec 2012 21:22:56 -0500
Only use mappings if mapping target exists
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js
@@ -119,20 +119,22 @@ Zotero.Styles = new function() {
*/
this.get = function(id) {
// Map some obsolete styles to current ones
- var mappings = {
+ const MAPPINGS = {
"http://www.zotero.org/styles/chicago-note": "http://www.zotero.org/styles/chicago-note-bibliography",
"http://www.zotero.org/styles/mhra_note_without_bibliography": "http://www.zotero.org/styles/mhra",
"http://www.zotero.org/styles/aaa": "http://www.zotero.org/styles/american-anthropological-association",
"http://www.zotero.org/styles/ama": "http://www.zotero.org/styles/american-medical-association",
"http://www.zotero.org/styles/nlm": "http://www.zotero.org/styles/national-library-of-medicine"
};
- if(mappings[id]) {
- Zotero.debug("Mapping " + id + " to " + mappings[id]);
- id = mappings[id];
+
+ if(!_initialized) this.init();
+
+ if(MAPPINGS.hasOwnProperty(id) && _styles[MAPPINGS[id]]) {
+ Zotero.debug("Mapping " + id + " to " + MAPPINGS[id]);
+ return _styles[MAPPINGS[id]];
}
- if(!_initialized) this.init();
- return _styles[id] ? _styles[id] : false;
+ return _styles[id] || false;
}
/**