From 1042e07a84445f1bffbd2e4e4c9596867ebebec9 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 3 Jun 2014 20:30:30 +0800 Subject: [PATCH] Ensure JSONEditor.Validator's ready is called properly when the ready callback is supplied to the init constructor on the options object (not used internally); fix comment placement --- src/validator.js | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/validator.js b/src/validator.js index c93728121..e71e155c2 100644 --- a/src/validator.js +++ b/src/validator.js @@ -4,14 +4,14 @@ JSONEditor.Validator = Class.extend({ this.options = options || {}; this.refs = this.options.refs || {}; - // Store any $ref and definitions this.ready_callbacks = []; - if(this.options.ready) this.ready(this.options.ready); + + // Store any $ref and definitions this.getRefs(); }, ready: function(callback) { - if(this.is_ready) callback.apply(self,[this.expanded]); + if(this.is_ready) callback.apply(this,[this.expanded]); else { this.ready_callbacks.push(callback); } @@ -72,9 +72,9 @@ JSONEditor.Validator = Class.extend({ } } // Expand out any references - else if(schema['$ref']) { - var ref = schema['$ref']; - delete schema['$ref']; + else if(schema.$ref) { + var ref = schema.$ref; + delete schema.$ref; // If we're currently loading this external reference, wait for it to be done if(self.refs[ref] && self.refs[ref] instanceof Array) { @@ -226,10 +226,10 @@ JSONEditor.Validator = Class.extend({ } // `enum` - if(schema.enum) { + if(schema['enum']) { valid = false; - for(i=0; i