From facd6fa7db1ea7f88e517f93dc564cbcfea95aa6 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Fri, 15 Aug 2014 17:55:23 -0400 Subject: [PATCH] Fix VMM.Library.prop and VMM.Library.attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prop() previously had a version check for jQuery’s prop() function which failed, causing it to never return values for e.g. scrollHeight. attribute() previously always hit the setter path because it didn’t check for value being undefined so it always called jQuery using the two argument form. --- source/js/Core/Core/VMM.Library.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/source/js/Core/Core/VMM.Library.js b/source/js/Core/Core/VMM.Library.js index ceb1809..0191c46 100644 --- a/source/js/Core/Core/VMM.Library.js +++ b/source/js/Core/Core/VMM.Library.js @@ -280,28 +280,27 @@ if(typeof VMM != 'undefined') { } } }, - + prop: function(element, aName, value) { - if (typeof jQuery == 'undefined' || !/[1-9]\.[3-9].[1-9]/.test(jQuery.fn.jquery)) { - VMM.Lib.attribute(element, aName, value); + if (typeof jQuery == 'undefined' || !('prop' in jQuery.fn)) { + return VMM.Lib.attribute(element, aName, value); + } else if (typeof value != 'undefined') { + return jQuery(element).prop(aName, value); } else { - jQuery(element).prop(aName, value); + return jQuery(element).prop(aName); } }, - + attribute: function(element, aName, value) { - - if (value != null && value != "") { - if( typeof( jQuery ) != 'undefined' ){ - jQuery(element).attr(aName, value); - } - } else { - if( typeof( jQuery ) != 'undefined' ){ + if (typeof(jQuery) != 'undefined') { + if (typeof(value) != 'undefined' && value != null && value != "") { + return jQuery(element).attr(aName, value); + } else { return jQuery(element).attr(aName); } } }, - + visible: function(element, show) { if (show != null) { if( typeof( jQuery ) != 'undefined' ){