Skip to content
This repository was archived by the owner on Apr 16, 2019. It is now read-only.

Commit 3503a4d

Browse files
author
Ian Maffett
committed
Provide some fixes for #609
1 parent b597a71 commit 3503a4d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

appframework.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ if (!window.af || typeof(af) !== "function") {
762762
if (this.length === 0)
763763
return (value === nundefined) ? undefined : this;
764764
if (value === nundefined && !$.isObject(attr)) {
765-
var val = (this[0].afmCacheId && _attrCache[this[0].afmCacheId][attr]) ? (this[0].afmCacheId && _attrCache[this[0].afmCacheId][attr]) : this[0].getAttribute(attr);
765+
var val = (this[0].afmCacheId && _attrCache[this[0].afmCacheId] && _attrCache[this[0].afmCacheId][attr]) ? _attrCache[this[0].afmCacheId][attr] : this[0].getAttribute(attr);
766766
return val;
767767
}
768768
for (var i = 0; i < this.length; i++) {
@@ -784,6 +784,8 @@ if (!window.af || typeof(af) !== "function") {
784784
delete _attrCache[this[i].afmCacheId][attr];
785785
} else {
786786
this[i].setAttribute(attr, value);
787+
if (this[i].afmCacheId && _attrCache[this[i].afmCacheId][attr])
788+
delete _attrCache[this[i].afmCacheId][attr];
787789
}
788790
}
789791
return this;
@@ -801,7 +803,7 @@ if (!window.af || typeof(af) !== "function") {
801803
removeAttr: function(attr) {
802804
var removeFixer=function(param) {
803805
that[i].removeAttribute(param);
804-
if (that[i].afmCacheId && _attrCache[that[i].afmCacheId][attr])
806+
if (that[i].afmCacheId && _attrCache[that[i].afmCacheId])
805807
delete _attrCache[that[i].afmCacheId][attr];
806808
};
807809
var that = this;
@@ -829,8 +831,8 @@ if (!window.af || typeof(af) !== "function") {
829831
if (this.length === 0)
830832
return (value === nundefined) ? undefined : this;
831833
if (value === nundefined && !$.isObject(prop)) {
832-
var res;
833-
var val = (this[0].afmCacheId && _propCache[this[0].afmCacheId][prop]) ? (this[0].afmCacheId && _propCache[this[0].afmCacheId][prop]) : !(res = this[0][prop]) && prop in this[0] ? this[0][prop] : res;
834+
var res;
835+
var val = (this[0].afmCacheId && _propCache[this[0].afmCacheId] && _propCache[this[0].afmCacheId][prop]) ? _propCache[this[0].afmCacheId][prop] : !(res = this[0][prop]) && prop in this[0] ? this[0][prop] : res;
834836
return val;
835837
}
836838
for (var i = 0; i < this.length; i++) {
@@ -839,7 +841,6 @@ if (!window.af || typeof(af) !== "function") {
839841
$(this[i]).prop(key, prop[key]);
840842
}
841843
} else if ($.isArray(value) || $.isObject(value) || $.isFunction(value)) {
842-
843844
if (!this[i].afmCacheId)
844845
this[i].afmCacheId = $.uuid();
845846

@@ -849,6 +850,8 @@ if (!window.af || typeof(af) !== "function") {
849850
} else if (value === null && value !== undefined) {
850851
$(this[i]).removeProp(prop);
851852
} else {
853+
if(_propCache[this[i].afmCacheId][prop])
854+
_propCache[this[i].afmCacheId][prop]=null;
852855
this[i][prop] = value;
853856
}
854857
}
@@ -868,7 +871,7 @@ if (!window.af || typeof(af) !== "function") {
868871
var removePropFn=function(param) {
869872
if (that[i][param])
870873
that[i][param] = undefined;
871-
if (that[i].afmCacheId && _propCache[that[i].afmCacheId][prop]) {
874+
if (that[i].afmCacheId && _propCache[that[i].afmCacheId]) {
872875
delete _propCache[that[i].afmCacheId][prop];
873876
}
874877
};

0 commit comments

Comments
 (0)