Skip to content

Commit

Permalink
FLUID-5185: Updated jQuery to version 1.11.0-beta2 and mockjax to ver…
Browse files Browse the repository at this point in the history
…sion 1.5.3. Ripped off jquery.migrate's version of $.browser into FluidDocument.js which has been added as dependency to all tests (demos still required). Beginning to deal with changes in jQuery's focus policy - converted HTML5 Uploader browseButton test to IoC scheme to deal with new asynchrony. All markup which deals in focus events now requires to be visible. Currently failing tests: InlineEdit, and anything which uses a tooltip
  • Loading branch information
amb26 committed Dec 20, 2013
1 parent a15346d commit d6443a0
Show file tree
Hide file tree
Showing 24 changed files with 8,282 additions and 7,050 deletions.
12 changes: 8 additions & 4 deletions src/components/uploader/js/HTML5UploaderSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,12 @@ var fluid_1_5 = fluid_1_5 || {};

fileInput.focus(function () {
that.browseButton.addClass("focus");
that.events.onFocusFileInput.fire(that, fileInput, true);
});

fileInput.blur(function () {
that.browseButton.removeClass("focus");
that.events.onFocusFileInput.fire(that, fileInput, false);
});
};

Expand All @@ -279,22 +281,23 @@ var fluid_1_5 = fluid_1_5 || {};
fileTypes = fileTypes.join();
multiFileInput.attr("accept", fileTypes);
}
fluid.uploader.bindEventsToFileInput(that, multiFileInput);
return multiFileInput;
};

fluid.uploader.renderFreshMultiFileInput = function (that) {
var previousInput = that.locate("fileInputs").last();
previousInput.hide();
previousInput.attr("tabindex", -1);
previousInput.prop("tabindex", -1);
var newInput = fluid.uploader.renderMultiFileInput(that);
previousInput.after(newInput);
previousInput.after(newInput);
fluid.uploader.bindEventsToFileInput(that, newInput);
};

fluid.uploader.setupBrowseButtonView = function (that) {
var multiFileInput = fluid.uploader.renderMultiFileInput(that);
that.browseButton.append(multiFileInput);
that.browseButton.attr("tabindex", -1);
fluid.uploader.bindEventsToFileInput(that, multiFileInput);
that.browseButton.prop("tabindex", -1);
};

fluid.uploader.isEnabled = function (element) {
Expand Down Expand Up @@ -333,6 +336,7 @@ var fluid_1_5 = fluid_1_5 || {};
fileInputs: ".flc-uploader-html5-input"
},
events: {
onFocusFileInput: null,
onBrowse: null,
onFilesQueued: null
},
Expand Down
47 changes: 44 additions & 3 deletions src/framework/core/js/FluidDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Copyright 2007-2010 University of Cambridge
Copyright 2007-2009 University of Toronto
Copyright 2010-2011 Lucendo Development Ltd.
Copyright 2010 OCAD University
Copyright 2005-2013 jQuery Foundation, Inc. and other contributors
Licensed under the Educational Community License (ECL), Version 2.0 or the New
BSD license. You may not use this file except in compliance with one these
Expand All @@ -24,6 +25,46 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
var fluid_1_5 = fluid_1_5 || {};

(function ($, fluid) {
// polyfill for $.browser which was removed in jQuery 1.9 and later
// Taken from jquery-migrate-1.2.1.js,
// jQuery Migrate - v1.2.1 - 2013-05-08
// https://github.com/jquery/jquery-migrate
// Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT

fluid.uaMatch = function (ua) {
ua = ua.toLowerCase();

var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || [];

return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};

var matched, browser;

// Don't clobber any existing jQuery.browser in case it's different
if (!$.browser) {
matched = fluid.uaMatch(navigator.userAgent);
browser = {};

if (matched.browser) {
browser[matched.browser] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if (browser.chrome) {
browser.webkit = true;
} else if (browser.webkit) {
browser.safari = true;
}
$.browser = browser;
}

// Private constants.
var NAMESPACE_KEY = "fluid-scoped-data";
Expand Down Expand Up @@ -56,13 +97,13 @@ var fluid_1_5 = fluid_1_5 || {};

var lastFocusedElement = null;

$(document).bind("focusin", function(event){
$(document).bind("focusin", function (event){
lastFocusedElement = event.target;
});

fluid.getLastFocusedElement = function() {
fluid.getLastFocusedElement = function () {
return lastFocusedElement;
}
};


var ENABLEMENT_KEY = "enablement";
Expand Down
2 changes: 1 addition & 1 deletion src/framework/core/js/FluidRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ var fluid_1_5 = fluid_1_5 || {};
url: resourceSpec.href,
success: thisCallback.success,
error: thisCallback.error,
dataType: "text"};
dataType: resourceSpec.dataType || "text"};
fluid.fetchResources.timeSuccessCallback(resourceSpec);
options = fluid.merge(fluid.defaults("fluid.fetchResources.issueRequest").mergePolicy,
options, resourceSpec.options);
Expand Down
Loading

0 comments on commit d6443a0

Please sign in to comment.