From d99b70e0b2e6d1a180f8990df67f4c0ddff66f2f Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 9 May 2012 08:51:16 +0100 Subject: [PATCH] Got rid of some potentially dodgy hasOwnProperty() calls --- core/modules/dependencies.js | 2 +- core/modules/macros/slider.js | 2 +- core/modules/macros/story.js | 8 ++++---- core/modules/treenodes/macro.js | 2 +- core/modules/utils.argparser.js | 4 ++-- core/modules/wiki.js | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/modules/dependencies.js b/core/modules/dependencies.js index 6f064dbfd..6d49c8695 100644 --- a/core/modules/dependencies.js +++ b/core/modules/dependencies.js @@ -68,7 +68,7 @@ Dependencies.prototype.hasChanged = function(changes,contextTiddlerTitle) { return true; } for(var c in changes) { - if(this.tiddlers.hasOwnProperty(c)) { + if($tw.utils.hop(this.tiddlers,c)) { return true; } } diff --git a/core/modules/macros/slider.js b/core/modules/macros/slider.js index 11d029df7..68323b56f 100644 --- a/core/modules/macros/slider.js +++ b/core/modules/macros/slider.js @@ -151,7 +151,7 @@ exports.executeMacro = function() { exports.refreshInDom = function(changes) { var needChildrenRefresh = true; // Avoid refreshing the children nodes if we don't need to // If the state tiddler has changed then reset the open state - if(this.hasParameter("state") && changes.hasOwnProperty(this.params.state)) { + if(this.hasParameter("state") && $tw.utils.hop(changes,this.params.state)) { this.isOpen = this.getOpenState(); } // Render the children if the slider is open and we don't have any children yet diff --git a/core/modules/macros/story.js b/core/modules/macros/story.js index 55998e853..b1a8d8cc0 100644 --- a/core/modules/macros/story.js +++ b/core/modules/macros/story.js @@ -39,7 +39,7 @@ exports.handleEvent = function(event) { template = this.hasParameter("defaultViewTemplate") ? this.params.defaultViewTemplate : "ViewTemplate"; storyTiddler = this.wiki.getTiddler(this.params.story); story = {tiddlers: []}; - if(storyTiddler && storyTiddler.fields.hasOwnProperty("text")) { + if(storyTiddler && $tw.utils.hop(storyTiddler.fields,"text")) { story = JSON.parse(storyTiddler.fields.text); } story.tiddlers.unshift({title: event.navigateTo, template: template}); @@ -52,7 +52,7 @@ exports.handleEvent = function(event) { template = this.hasParameter("defaultEditTemplate") ? this.params.defaultEditTemplate : "EditTemplate"; storyTiddler = this.wiki.getTiddler(this.params.story); story = {tiddlers: []}; - if(storyTiddler && storyTiddler.fields.hasOwnProperty("text")) { + if(storyTiddler && $tw.utils.hop(storyTiddler.fields,"text")) { story = JSON.parse(storyTiddler.fields.text); } for(t=0; t