change more set_ and get_ prefixes
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/31e50c86 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/31e50c86 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/31e50c86 Branch: refs/heads/develop Commit: 31e50c8614fcd4e6a52402e05bb0113ad555ac5e Parents: 9c7b2ef Author: Alex Harui <aha...@apache.org> Authored: Fri Jan 30 10:50:49 2015 -0800 Committer: Alex Harui <aha...@apache.org> Committed: Fri Jan 30 10:50:49 2015 -0800 ---------------------------------------------------------------------- .../src/org/apache/flex/binding/BindingBase.js | 10 +-- .../src/org/apache/flex/binding/ChainBinding.js | 25 ++----- .../org/apache/flex/binding/ConstantBinding.js | 7 +- .../org/apache/flex/binding/GenericBinding.js | 25 +++---- .../org/apache/flex/binding/SimpleBinding.js | 10 +-- .../src/org/apache/flex/core/DataBindingBase.js | 49 -------------- .../src/org/apache/flex/core/FormatBase.js | 2 +- .../org/apache/flex/core/SimpleStatesImpl.js | 63 +++--------------- .../org/apache/flex/core/ViewBaseDataBinding.js | 36 ++-------- .../org/apache/flex/events/EventDispatcher.js | 31 --------- .../org/apache/flex/net/JSONItemConverter.js | 32 --------- .../src/org/apache/flex/utils/Language.js | 16 ++--- .../apache/flex/utils/MXMLDataInterpreter.js | 69 +++++--------------- 13 files changed, 60 insertions(+), 315 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js index aea3087..1854a18 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/BindingBase.js @@ -83,10 +83,7 @@ org_apache_flex_binding_BindingBase.prototype.set_strand = function(value) { if (this.destination == null) this.destination = value; if (this.sourceID != null) { - if (typeof(this.document['get_' + this.sourceID]) === 'function') - this.source = this.document['get_' + this.sourceID](); - else - this.source = this.document[this.sourceID]; + this.source = this.document[this.sourceID]; if (this.source == null) { this.document.addEventListener('valueChange', goog.bind(this.sourceChangeHandler, this)); @@ -118,8 +115,5 @@ org_apache_flex_binding_BindingBase.prototype.sourceChangeHandler = function(eve this.source.removeEventListener(this.eventName, goog.bind(this.changeHandler, this)); - if (typeof(this.document['get_' + this.sourceID]) === 'function') - this.source = this.document['get_' + this.sourceID](); - else - this.source = this.document[this.sourceID]; + this.source = this.document[this.sourceID]; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/binding/ChainBinding.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/ChainBinding.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/ChainBinding.js index 3730dbf..21dd2eb 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/binding/ChainBinding.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/ChainBinding.js @@ -90,10 +90,7 @@ org_apache_flex_binding_ChainBinding.prototype.evaluateSourceChain = function() for (var i = 0; i < n - 1; i++) { propName = this.source[i]; var propObj; - if (typeof(obj['get_' + propName]) === 'function') - propObj = obj['get_' + propName](); - else - propObj = obj[propName]; + propObj = obj[propName]; var watcher = new org_apache_flex_binding_ChainWatcher(propName, this.applyBinding); obj.addEventListener('valueChange', watcher.handler); if (propObj == null) @@ -111,10 +108,7 @@ org_apache_flex_binding_ChainBinding.prototype.evaluateSourceChain = function() obj.addEventListener('valueChange', valueChangeHandler); // we have a complete chain, get the value - if (typeof(obj['get_' + propName]) === 'function') - this.value = obj['get_' + propName](); - else - this.value = obj[propName]; + this.value = obj[propName]; return true; }; @@ -132,10 +126,7 @@ org_apache_flex_binding_ChainBinding.prototype.applyValue = function() { } if (typeof(this.destination) === 'string') { destinationName = this.destination; - if (typeof(this.document['set_' + destinationName]) === 'function') - this.document['set_' + destinationName](this.value); - else - this.document[destinationName] = this.value; + this.document[destinationName] = this.value; return; } @@ -145,20 +136,14 @@ org_apache_flex_binding_ChainBinding.prototype.applyValue = function() { for (var i = 0; i < n - 1; i++) { var propName = this.destination[i]; var propObj; - if (typeof(obj['get_' + propName]) === 'function') - propObj = obj['get_' + propName](); - else - propObj = obj[propName]; + propObj = obj[propName]; if (propObj == null) { obj.addEventListener('valueChange', handler); return; } obj = propObj; } - if (typeof(obj['set_' + this.destination[n - 1]]) === 'function') - obj['set_' + this.destination[n - 1]](this.value); - else - obj[this.destination[n - 1]] = this.value; + obj[this.destination[n - 1]] = this.value; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js index a4bb0c5..36d22c3 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/ConstantBinding.js @@ -48,15 +48,12 @@ org_apache_flex_binding_ConstantBinding.prototype.set_strand = function(value) { var val; try { - val = this.source['get_' + this.sourcePropertyName](); + val = this.source[this.sourcePropertyName]; } catch (e) { try { val = this.source.constructor[this.sourcePropertyName]; } catch (e2) { } } - if (typeof(this.destination['set_' + this.destinationPropertyName]) === 'function') - this.destination['set_' + this.destinationPropertyName](val); - else - this.destination[this.destinationPropertyName] = val; + this.destination[this.destinationPropertyName] = val; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/binding/GenericBinding.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/GenericBinding.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/GenericBinding.js index 2fd6373..f162f9b 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/binding/GenericBinding.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/GenericBinding.js @@ -82,12 +82,12 @@ org_apache_flex_binding_GenericBinding.prototype.getValueFromSource = { var arr = this.source; var n = arr.length; - obj = this.document['get_' + arr[0]](); + obj = this.document[arr[0]]; if (obj == null) return null; for (var i = 1; i < n; i++) { - obj = obj['get_' + arr[i]](); + obj = obj[arr[i]]; if (obj == null) return null; } @@ -101,7 +101,7 @@ org_apache_flex_binding_GenericBinding.prototype.getValueFromSource = } else if (typeof(this.source) == 'string') { - obj = this.document['get_' + this.source](); + obj = this.document[this.source]; return obj; } return null; @@ -123,11 +123,8 @@ org_apache_flex_binding_GenericBinding.prototype.applyValue = var arr = this.destinationData; var n = arr.length; var obj; - var getter = 'get_' + arr[0]; - if (typeof(this.document[getter]) === 'function') - obj = this.document[getter](); - else - obj = this.document[arr[0]]; + var getter = arr[0]; + obj = this.document[arr[0]]; if (obj == null) { this.document.addEventListener( org_apache_flex_events_ValueChangeEvent.VALUE_CHANGE, @@ -136,18 +133,12 @@ org_apache_flex_binding_GenericBinding.prototype.applyValue = } for (var i = 1; i < n - 1; i++) { - getter = 'get_' + arr[i]; - if (typeof(this.document[getter]) === 'function') - obj = obj[getter](); - else - obj = obj[arr[i]]; + getter = arr[i]; + obj = obj[arr[i]]; if (obj == null) return; } - var setter = 'set_' + arr[n - 1]; - if (typeof(obj[setter]) === 'function') - obj[setter](value); - else + var setter = arr[n - 1]; obj[arr[n - 1]] = value; } }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js b/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js index f1b16e4..fca7e87 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/binding/SimpleBinding.js @@ -50,14 +50,8 @@ org_apache_flex_binding_SimpleBinding.prototype.eventName = ''; * @expose */ org_apache_flex_binding_SimpleBinding.prototype.changeHandler = function() { - if (typeof(this.destination['set_' + this.destinationPropertyName]) === 'function') - this.destination['set_' + this.destinationPropertyName]( - this.source['get_' + this.sourcePropertyName]() - ); - else { - this.destination[this.destinationPropertyName] = - this.source['get_' + this.sourcePropertyName](); - } + this.destination[this.destinationPropertyName] = + this.source[this.sourcePropertyName]; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js index 9e36a85..7445ffd 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/DataBindingBase.js @@ -32,52 +32,3 @@ org_apache_flex_core_DataBindingBase.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'DataBindingBase', qName: 'org_apache_flex_core_DataBindingBase'}] }; - -/** - * @expose - * @param {Object} obj The object. - * @param {string} propName The name of the property. - * @return {boolean} True if property exists. - */ -org_apache_flex_core_DataBindingBase.prototype.hasProperty = - function(obj, propName) { - if (typeof obj['get_' + propName] === 'function') { - return true; - } - return (propName in obj); -}; - - -/** - * @expose - * @param {Object} obj The object. - * @param {string} propName The name of the property. - * @return {Object} value The value of the property. - */ -org_apache_flex_core_DataBindingBase.prototype.getProperty = - function(obj, propName) { - if (propName == 'this') - return obj; - - if (typeof obj['get_' + propName] === 'function') { - return obj['get_' + propName](); - } - return obj[propName]; -}; - - -/** - * @expose - * @param {Object} obj The object. - * @param {string} propName The name of the property. - * @param {Object} value The value of the property. - */ -org_apache_flex_core_DataBindingBase.prototype.setProperty = -function(obj, propName, value) { - if (typeof obj['set_' + propName] === 'function') { - obj['set_' + propName](value); - } else { - obj[propName] = value; - } -}; - http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js index 19494fd..8b83cf8 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/FormatBase.js @@ -86,7 +86,7 @@ org_apache_flex_core_FormatBase.prototype._formattedResult = ''; * @return {Object} */ org_apache_flex_core_FormatBase.prototype.get_propertyValue = function() { - var value = this.strand_['get_' + this.propertyName](); + var value = this.strand_[this.propertyName]; return value; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js index 6b12d08..d95219c 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleStatesImpl.js @@ -138,11 +138,7 @@ org_apache_flex_core_SimpleStatesImpl.prototype.revert_ = function(s) { parent = o.document; if (o.destination) { - if (typeof(o.document['get_' + o.destination]) === 'function') { - parent = o.document['get_' + o.destination](); - } else { - parent = o.document[o.destination]; - } + parent = o.document[o.destination]; } parent.removeElement(item); @@ -150,23 +146,10 @@ org_apache_flex_core_SimpleStatesImpl.prototype.revert_ = function(s) { new org_apache_flex_events_Event('childrenAdded')); } } else if (org_apache_flex_utils_Language.is(o, mx_states_SetProperty)) { - if (typeof(o.document['get_' + o.target]) === 'function') { - target = o.document['get_' + o.target](); - } else { - target = o.document[o.target]; - } - - if (typeof(target['set_' + o.name]) === 'function') { - target['set_' + o.name](o.previousValue); - } else { - target[o.name] = o.previousValue; - } + target = o.document[o.target]; + target[o.name] = o.previousValue; } else if (org_apache_flex_utils_Language.is(o, mx_states_SetEventHandler)) { - if (typeof(o.document['get_' + o.target]) === 'function') { - target = o.document['get_' + o.target](); - } else { - target = o.document[o.target]; - } + target = o.document[o.target]; target.removeEventListener(o.name, o.handlerFunction); } } @@ -202,19 +185,11 @@ org_apache_flex_core_SimpleStatesImpl.prototype.apply_ = function(s) { parent = o.document; if (o.destination) { - if (typeof(o.document['get_' + o.destination]) === 'function') { - parent = o.document['get_' + o.destination](); - } else { - parent = o.document[o.destination]; - } + parent = o.document[o.destination]; } if (o.relativeTo) { - if (typeof(o.document['get_' + o.relativeTo]) === 'function') { - child = o.document['get_' + o.relativeTo](); - } else { - child = o.document[o.relativeTo]; - } + child = o.document[o.relativeTo]; index = parent.getElementIndex(child); if (o.position === 'after') { @@ -232,29 +207,11 @@ org_apache_flex_core_SimpleStatesImpl.prototype.apply_ = function(s) { } else if (org_apache_flex_utils_Language.is(o, mx_states_SetProperty)) { - if (typeof(o.document['get_' + o.target]) === 'function') { - target = o.document['get_' + o.target](); - } else { - target = o.document[o.target]; - } - - if (typeof(target['get_' + o.name]) === 'function') { - o.previousValue = target['get_' + o.name](); - } else { - o.previousValue = target[o.name]; - } - - if (typeof(target['set_' + o.name]) === 'function') { - target['set_' + o.name](o.value); - } else { - target[o.name] = o.value; - } + target = o.document[o.target]; + o.previousValue = target[o.name]; + target[o.name] = o.value; } else if (org_apache_flex_utils_Language.is(o, mx_states_SetEventHandler)) { - if (typeof(o.document['get_' + o.target]) === 'function') { - target = o.document['get_' + o.target](); - } else { - target = o.document[o.target]; - } + target = o.document[o.target]; target.addEventListener(o.name, o.handlerFunction); } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBaseDataBinding.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBaseDataBinding.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBaseDataBinding.js index 2380e40..7562f22 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBaseDataBinding.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ViewBaseDataBinding.js @@ -121,12 +121,7 @@ org_apache_flex_core_ViewBaseDataBinding.prototype.initCompleteHandler = sb.setDocument(this.strand_); prop = binding.destination[0]; - if (typeof(this.strand_['get_' + - prop]) == 'function') - destination = this.strand_[ - 'get_' + prop](); - else - destination = this.strand_[prop]; + destination = this.strand_[prop]; if (destination) destination.addBead(sb); @@ -149,12 +144,7 @@ org_apache_flex_core_ViewBaseDataBinding.prototype.initCompleteHandler = cb.sourcePropertyName = binding.source[1]; cb.setDocument(this.strand_); prop = binding.destination[0]; - if (typeof(this.strand_['get_' + - prop]) == 'function') - destination = this.strand_[ - 'get_' + prop](); - else - destination = this.strand_[prop]; + destination = this.strand_[prop]; if (destination) destination.addBead(cb); @@ -180,12 +170,7 @@ org_apache_flex_core_ViewBaseDataBinding.prototype.initCompleteHandler = sb.sourcePropertyName = binding.source; sb.setDocument(this.strand_); prop = binding.destination[0]; - if (typeof(this.strand_['get_' + - prop]) == 'function') - destination = this.strand_[ - 'get_' + prop](); - else - destination = this.strand_[prop]; + destination = this.strand_[prop]; if (destination) destination.addBead(sb); @@ -351,18 +336,9 @@ org_apache_flex_core_ViewBaseDataBinding.prototype.deferredBindingsHandler = for (p in this.deferredBindings) { if (p != event.propertyName) continue; - if (typeof(this.strand_['get_' + p]) == 'function') - { - destination = this.strand_['get_' + p](); - destination.addBead(this.deferredBindings[p]); - delete this.deferredBindings[p]; - } - else if (this.strand_[p] != null) - { - destination = this.strand_[p]; - destination.addBead(this.deferredBindings[p]); - delete this.deferredBindings[p]; - } + destination = this.strand_[p]; + destination.addBead(this.deferredBindings[p]); + delete this.deferredBindings[p]; } }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js index e508d25..e1e2fb7 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js @@ -69,37 +69,6 @@ org_apache_flex_events_EventDispatcher.prototype.addEventListener = /** - * @expose - * @param {Object} obj The object. - * @param {string} propName The name of the property. - * @return {Object} value The value of the property. - */ -org_apache_flex_events_EventDispatcher.prototype.getProperty = - function(obj, propName) { - if (typeof obj['get_' + propName] === 'function') { - return obj['get_' + propName](); - } - return obj[propName]; -}; - - -/** - * @expose - * @param {Object} obj The object. - * @param {string} propName The name of the property. - * @param {Object} value The value of the property. - */ -org_apache_flex_events_EventDispatcher.prototype.setProperty = -function(obj, propName, value) { - if (typeof obj['set_' + propName] === 'function') { - obj['set_' + propName](value); - } else { - obj[propName] = value; - } -}; - - -/** * @type {Object} */ org_apache_flex_events_EventDispatcher.elementEvents = { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js b/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js index 698b514..5434a15 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/net/JSONItemConverter.js @@ -46,35 +46,3 @@ org_apache_flex_net_JSONItemConverter.prototype.convertItem = function(s) { s += '}'; return JSON.parse(s); }; - - -/** - * @expose - * @param {Object} obj The object. - * @param {string} propName The name of the property. - * @return {Object} value The value of the property. - */ -org_apache_flex_net_JSONItemConverter.prototype.getProperty = - function(obj, propName) { - if (typeof obj['get_' + propName] === 'function') { - return obj['get_' + propName](); - } - return obj[propName]; -}; - - -/** - * @expose - * @param {Object} obj The object. - * @param {string} propName The name of the property. - * @param {Object} value The value of the property. - */ -org_apache_flex_net_JSONItemConverter.prototype.setProperty = -function(obj, propName, value) { - if (typeof obj['set_' + propName] === 'function') { - obj['set_' + propName](value); - } else { - obj[propName] = value; - } -}; - http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js index d697751..fb3e893 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/Language.js @@ -198,8 +198,8 @@ org_apache_flex_utils_Language.uint = function(value) { * @return {number} */ org_apache_flex_utils_Language.preincrement = function(obj, prop) { - var value = obj['get_' + prop]() + 1; - obj['set_' + prop](value); + var value = obj[prop] + 1; + obj[prop] = value; return value; }; @@ -213,8 +213,8 @@ org_apache_flex_utils_Language.preincrement = function(obj, prop) { * @return {number} */ org_apache_flex_utils_Language.predecrement = function(obj, prop) { - var value = obj['get_' + prop]() - 1; - obj['set_' + prop](value); + var value = obj[prop] - 1; + obj[prop] = value; return value; }; @@ -228,8 +228,8 @@ org_apache_flex_utils_Language.predecrement = function(obj, prop) { * @return {number} */ org_apache_flex_utils_Language.postincrement = function(obj, prop) { - var value = obj['get_' + prop](); - obj['set_' + prop](value + 1); + var value = obj[prop]; + obj[prop] = value + 1; return value; }; @@ -243,7 +243,7 @@ org_apache_flex_utils_Language.postincrement = function(obj, prop) { * @return {number} */ org_apache_flex_utils_Language.postdecrement = function(obj, prop) { - var value = obj['get_' + prop](); - obj['set_' + prop](value + 1); + var value = obj[prop]; + obj[prop] = value + 1; return value; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/31e50c86/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js b/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js index 95f95da..eb9f090 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/MXMLDataInterpreter.js @@ -68,7 +68,7 @@ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLObject = } if (name === 'id') { - document['set_' + value](comp); + document[value] = comp; id = value; } @@ -80,16 +80,12 @@ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLObject = id = value; } else if (name === 'id') { - if (typeof(comp['set_id']) === 'function') { - comp['set_id'](value); - } + try { + comp.id = value; + } catch (e) {}; } else { - if (typeof comp['set_' + name] === 'function') { - comp['set_' + name](value); - } else { - comp[name] = value; - } + comp[name] = value; } } @@ -161,11 +157,7 @@ org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject = value = generateMXMLObject(document, value); } - if (typeof comp['set_' + name] === 'function') { - comp['set_' + name](value); - } else { - comp[name] = value; - } + comp[name] = value; } beadOffset = i + (m - 1) * 3; @@ -188,7 +180,7 @@ org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject = if (name === 'id') { id = value; - document['set_' + value](comp); + document[value] = comp; } if (name === 'document' && !comp.document) { @@ -196,15 +188,11 @@ org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject = } else if (name === '_id') { id = value; // and don't assign to comp } else if (name === 'id') { - if (typeof(comp['set_id']) === 'function') { - comp['set_id'](value); - } + try { + comp.id = value; + } catch (e) {}; } else { - if (typeof(comp['set_' + name]) === 'function') { - comp['set_' + name](value); - } else { - comp[name] = value; - } + comp[name] = value; } } @@ -219,11 +207,7 @@ org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject = } else if (simple === false) { value = generateMXMLObject(document, value); } - if (typeof(comp['set_' + name]) === 'function') { - comp['set_' + name](value); - } else { - comp[name] = value; - } + comp[name] = value; } m = data[i++]; // num styles @@ -286,11 +270,7 @@ org_apache_flex_utils_MXMLDataInterpreter.initializeStrandBasedObject = } if (id) { - if (typeof(document['set_' + id]) === 'function') { - document['set_' + id](comp); - } else { - document[id] = comp; - } + document[id] = comp; } if (typeof(comp.setDocument) === 'function') { @@ -368,11 +348,7 @@ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLProperties = if (name === '_id') { id = value; // and don't assign } else { - if (typeof(host['set_' + name]) === 'function') { - host['set_' + name](value); - } else { - host[name] = value; - } + host[name] = value; } } @@ -385,12 +361,6 @@ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLProperties = value = generateMXMLArray(host, null, value); } else if (simple === false) { value = generateMXMLObject(host, value); - } else { - if (typeof(host['set_' + name]) === 'function') { - host['set_' + name](value); - } else { - host[name] = value; - } } beads = value; @@ -413,11 +383,7 @@ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLProperties = value = generateMXMLObject(host, value); } - if (typeof(host['set_' + name]) === 'function') { - host['set_' + name](value); - } else { - host[name] = value; - } + host[name] = value; } /* @@ -431,10 +397,7 @@ org_apache_flex_utils_MXMLDataInterpreter.generateMXMLProperties = value = generateMXMLArray(host, null, value, false); else if (simple === false) value = generateMXMLObject(host, value); - if (typeof(host['set_' + name]) == 'function') - host['set_' + name](value); - else - host[name] = value; + host[name] = value; } */