Skip to content

Commit 589fbe2

Browse files
committed
upgrade jquery to 1.6.4 and jquery-ui to 1.8.16
As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set Change-Id: Ibc2301735bb038ee2f897dfc12049012211d1620 Reviewed-on: https://gerrit.instructure.com/5452 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Ryan Shaw <ryan@instructure.com>
1 parent 3dc8ecc commit 589fbe2

48 files changed

Lines changed: 12105 additions & 20077 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/coffeescripts/gradebook2.coffee

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ I18n.scoped 'gradebook2', (I18n) ->
316316

317317
initHeader: () =>
318318
if @sections_enabled
319-
$courseSectionTemplate = jQUI19('#course_section_template').removeAttr('id').detach()
320-
$sectionToShowMenu = jQUI19('#section_to_show').next()
319+
$courseSectionTemplate = $('#course_section_template').removeAttr('id').detach()
320+
$sectionToShowMenu = $('#section_to_show').next()
321321
allSectionsText = $('#section_being_shown').text()
322322
$('#section_being_shown').text(@sections[@sectionToShow].name) if @sectionToShow
323323
for i, section of @sections
@@ -329,22 +329,22 @@ I18n.scoped 'gradebook2', (I18n) ->
329329
.find('input')
330330
.attr(id: "section_option_#{section.id}", value: section.id)
331331
.prop('checked', section.id == @sectionToShow)
332-
jQUI19('#section_to_show').show().kyleMenu
332+
$('#section_to_show').show().kyleMenu
333333
buttonOpts: {icons: {primary: "ui-icon-sections", secondary: "ui-icon-droparrow"}}
334334
$sectionToShowMenu.bind 'menuselect', (event, ui) =>
335335
@sectionToShow = Number($sectionToShowMenu.find('input[name="section_to_show_radio"]:checked').val()) || undefined
336336
$.store[ if @sectionToShow then 'userSet' else 'userRemove']("grading_show_only_section#{@options.context_id}", @sectionToShow)
337337
$('#section_being_shown').text(if @sectionToShow then @sections[@sectionToShow].name else allSectionsText)
338338
@buildRows()
339339

340-
$settingsMenu = jQUI19('#gradebook_settings').next()
340+
$settingsMenu = $('#gradebook_settings').next()
341341
$.each ['show_attendance', 'include_ungraded_assignments'], (i, setting) =>
342342
$settingsMenu.find("##{setting}").prop('checked', @[setting]).change (event) =>
343343
@[setting] = $(event.target).is(':checked')
344344
$.store.userSet "#{setting}_#{@options.context_code}", (''+@[setting])
345345
@buildRows()
346346

347-
jQUI19('#gradebook_settings').show().kyleMenu
347+
$('#gradebook_settings').show().kyleMenu
348348
buttonOpts: {icons: {primary: "ui-icon-cog", secondary: "ui-icon-droparrow"}}
349349

350350
$settingsMenu.find('.gradebook_upload_link').click (event) ->

app/coffeescripts/jquery.kylemenu.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
open: (event) ->
1616
# handle sticking the carat right below where you clicked on the button
1717
$(this).find(".ui-menu-carat").remove()
18-
$trigger = jQUI19(this).popup("option", "trigger")
18+
$trigger = $(this).popup("option", "trigger")
1919
triggerWidth = $trigger.width()
2020
differenceInWidth = $(this).width() - triggerWidth
2121
actualOffset = event.pageX - $trigger.offset().left

app/views/content_imports/copy_course.html.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ $(document).ready(function() {
304304
var $checkbox = $("#copy_all_topics");
305305
var include_secondaries = $(this).hasClass('include');
306306
if(include_secondaries) {
307-
$checkbox.parent().next("ul").find(":checkbox:not(.secondary_checkbox)").attr('checked', $checkbox.attr('checked')).each(function() { $(this).triggerHandler('change', true); });
307+
$checkbox.parent().next("ul").find(":checkbox:not(.secondary_checkbox)").prop('checked', $checkbox.prop('checked')).each(function() { $(this).triggerHandler('change', true); });
308308
} else {
309-
$checkbox.parent().next("ul").find(":checkbox:not(.secondary_checkbox)").attr('checked', $checkbox.attr('checked'));
309+
$checkbox.parent().next("ul").find(":checkbox:not(.secondary_checkbox)").prop('checked', $checkbox.prop('checked'));
310310
}
311311
$("#copy_entries_dialog").dialog('close');
312312
});
@@ -322,12 +322,12 @@ $(document).ready(function() {
322322
width: 370
323323
}).dialog('open');
324324
} else {
325-
$(this).parent().next("ul").find(":checkbox:not(.secondary_checkbox)").attr('checked', $(this).attr('checked')).each(function() { $(this).triggerHandler('change'); });
325+
$(this).parent().next("ul").find(":checkbox:not(.secondary_checkbox)").prop('checked', $(this).prop('checked')).each(function() { $(this).triggerHandler('change'); });
326326
$('#copy_everything').attr('checked', false);
327327
}
328328
} else if($(this).hasClass('copy_everything')) {
329-
$("#copy_context_form :checkbox:not(.secondary_checkbox):not(.copy_everything):not(.skip_on_everything):not(.shift_dates_checkbox)").attr('checked', $(this).attr('checked')).filter(":not(.copy_all)").each(function() { $(this).triggerHandler('change'); });
330-
$("#copy_all_topics").attr('checked', $(this).attr('checked')).triggerHandler('change');
329+
$("#copy_context_form :checkbox:not(.secondary_checkbox):not(.copy_everything):not(.skip_on_everything):not(.shift_dates_checkbox)").prop('checked', $(this).prop('checked')).filter(":not(.copy_all)").each(function() { $(this).triggerHandler('change'); });
330+
$("#copy_all_topics").prop('checked', $(this).prop('checked')).triggerHandler('change');
331331
} else {
332332
$(this).parent().find(":checkbox.secondary_checkbox" + (force_secondaries ? '' : ':not(.skip)')).attr('checked', $(this).attr('checked'));
333333
if($(this).hasClass('secondary_checkbox') && $(this).attr('checked')) {

app/views/content_imports/migrate_content_choose.html.erb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,24 +418,24 @@ $(document).ready(function() {
418418
}
419419
$("#copy_files_list").showIf(file_count > 0);
420420
$("#copy_context_form .course_name").text(data.name);
421-
$("#copy_everything").attr('checked', true).change();
421+
$("#copy_everything").prop('checked', true).change();
422422
});
423423
$("#copy_context_form :checkbox").change(function() {
424424
if($(this).hasClass('copy_all')) {
425-
$(this).parent().nextAll("ul").find(":checkbox:not(.secondary_checkbox)").attr('checked', $(this).attr('checked')).each(function() { $(this).triggerHandler('change'); });
425+
$(this).parent().nextAll("ul").find(":checkbox:not(.secondary_checkbox)").prop('checked', $(this).prop('checked')).each(function() { $(this).triggerHandler('change'); });
426426
} else if($(this).hasClass('copy_everything')) {
427-
$("#copy_context_form :checkbox:not(.secondary_checkbox):not(.copy_everything)").attr('checked', $(this).attr('checked')).filter(":not(.copy_all)").each(function() { $(this).triggerHandler('change'); });
427+
$("#copy_context_form :checkbox:not(.secondary_checkbox):not(.copy_everything)").prop('checked', $(this).prop('checked')).filter(":not(.copy_all)").each(function() { $(this).triggerHandler('change'); });
428428
} else {
429-
$(this).parent().find(":checkbox.secondary_checkbox").attr('checked', $(this).attr('checked'));
430-
if(!$(this).attr('checked')) {
429+
$(this).parent().find(":checkbox.secondary_checkbox").prop('checked', $(this).prop('checked'));
430+
if(!$(this).prop('checked')) {
431431
$(this).parents("ul").each(function() {
432-
$(this).prev("h2,h3,h4").find(":checkbox").attr('checked', false);
432+
$(this).prev("h2,h3,h4").find(":checkbox").prop('checked', false);
433433
});
434434
}
435435
}
436436
});
437437
$(".shift_dates_checkbox").change(function() {
438-
$(".shift_dates_settings").showIf($(this).attr('checked'));
438+
$(".shift_dates_settings").showIf($(this).prop('checked'));
439439
}).change();
440440
$(".add_substitution_link").click(function(event) {
441441
event.preventDefault();

app/views/gradebook2/jquery_ui_menu_test.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<% js_block do %>
33
<script>
44
$(function() {
5-
jQUI19('#section_to_show')
5+
$('#section_to_show')
66
.kyleMenu()
77
.next().bind('menuselect', function(event, ui){
88
$("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");

app/views/gradebooks/speed_grader.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<%
2-
jammit_js :speed_grader
2+
jammit_js :jquery_ui_menu, :speed_grader
33
jammit_css :speed_grader
44
@show_left_side = false
55
@can_edit_anything = !@context.completed?

config/assets.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,38 @@ javascripts:
1111
- public/javascripts/datejs_to_iso_string_patch.js
1212
- public/javascripts/date.js
1313
- public/javascripts/handlebars.vm.js
14-
- public/javascripts/jquery-1.5.2.js
15-
- public/javascripts/jquery-ui-1.8.js
14+
- public/javascripts/jquery-1.6.4.js
15+
# jquery ui modules and effects that we don't actually use are commented out to reduce payload
16+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.core.js
17+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.widget.js
18+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.mouse.js
19+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.position.js
20+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.draggable.js
21+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.droppable.js
22+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.resizable.js
23+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.selectable.js
24+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.sortable.js
25+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.accordion.js
26+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.autocomplete.js
27+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.button.js
28+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.dialog.js
29+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.slider.js
30+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.tabs.js
31+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.datepicker.js
32+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.ui.progressbar.js
33+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.core.js
34+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.blind.js
35+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.bounce.js
36+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.clip.js
37+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.drop.js
38+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.explode.js
39+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.fold.js
40+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.highlight.js
41+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.pulsate.js
42+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.scale.js
43+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.shake.js
44+
- public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.slide.js
45+
# - public/javascripts/jquery-ui-1.8.16/ui/jquery.effects.transfer.js
1646
- public/javascripts/i18n.js
1747
- public/javascripts/jquery.ba-throttle-debounce.js
1848
- public/javascripts/jquery.ba-tinypubsub.js
@@ -132,7 +162,6 @@ javascripts:
132162
datagrid:
133163
- public/javascripts/datagrid.js
134164
jquery_ui_menu:
135-
- public/javascripts/jquery-1.6.2.js
136165
- public/javascripts/jquery.ui.core-1.9.js
137166
- public/javascripts/jquery.ui.position-1.9.js
138167
- public/javascripts/jquery.ui.widget-1.9.js
@@ -141,7 +170,6 @@ javascripts:
141170
- public/javascripts/jquery.ui.popup-1.9.js
142171
- public/javascripts/jquery.ui.menu.inputmenu.js
143172
- public/javascripts/compiled/jquery.kylemenu.js
144-
- public/javascripts/jquery.ui.menu-1.9_unsetup.js
145173
gradebook2:
146174
- public/javascripts/compiled/multi_grid.js
147175
- public/javascripts/compiled/grade_calculator.js

public/javascripts/compiled/gradebook2.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/javascripts/compiled/jquery.kylemenu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
open: function(event) {
2424
var $trigger, actualOffset, caratOffset, differenceInWidth, triggerWidth;
2525
$(this).find(".ui-menu-carat").remove();
26-
$trigger = jQUI19(this).popup("option", "trigger");
26+
$trigger = $(this).popup("option", "trigger");
2727
triggerWidth = $trigger.width();
2828
differenceInWidth = $(this).width() - triggerWidth;
2929
actualOffset = event.pageX - $trigger.offset().left;

public/javascripts/instructure_helper.js

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -89,42 +89,6 @@ I18n.scoped('instructure', function(I18n) {
8989
});
9090
return result;
9191
};
92-
93-
94-
// this is just pulled from jquery 1.6 because jquery 1.5 could not do .map on an object
95-
$.map = function (elems, callback, arg) {
96-
var value, key, ret = [],
97-
i = 0,
98-
length = elems.length,
99-
100-
101-
// jquery objects are treated as arrays
102-
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ((length > 0 && elems[0] && elems[length - 1]) || length === 0 || jQuery.isArray(elems));
103-
104-
// Go through the array, translating each of the items to their
105-
if (isArray) {
106-
for (; i < length; i++) {
107-
value = callback(elems[i], i, arg);
108-
109-
if (value != null) {
110-
ret[ret.length] = value;
111-
}
112-
}
113-
114-
// Go through every key on the object,
115-
} else {
116-
for (key in elems) {
117-
value = callback(elems[key], key, arg);
118-
119-
if (value != null) {
120-
ret[ret.length] = value;
121-
}
122-
}
123-
}
124-
125-
// Flatten any nested arrays
126-
return ret.concat.apply([], ret);
127-
}
12892

12993
// add ability to handle css3 opacity transitions on show or hide
13094
// if you want to use this just add the class 'use-css-transitions-for-show-hide' to an element.
@@ -791,7 +755,7 @@ I18n.scoped('instructure', function(I18n) {
791755
val = $input.editorBox('get_code', false);
792756
}
793757
} catch(e) {}
794-
var attr = $input.attr('name');
758+
var attr = $input.prop('name') || '';
795759
var multiValue = attr.match(/\[\]$/)
796760
if(inputType == 'hidden' && !multiValue) {
797761
if($form.find("[name='" + attr + "']").filter("textarea,:radio:checked,:checkbox:checked,:text,:password,select,:hidden")[0] != $input[0]) {
@@ -2853,24 +2817,33 @@ I18n.scoped('instructure', function(I18n) {
28532817
});
28542818
return $picker;
28552819
};
2820+
2821+
// This is so that if you disable an element, that it also gives it the class disabled.
2822+
// that way you can add css classes for our friend IE6. so rather than using selector:disabled,
2823+
// you can do selector.disabled.
2824+
// works on both $(elem).attr('disabled', ...) AND $(elem).prop('disabled', ...)
2825+
$.each([ "prop", "attr" ], function(i, propOrAttr ) {
2826+
// set the `disabled.set` hook like this so we don't override any existing `get` hook
2827+
$[propOrAttr+'Hooks'].disabled = jQuery.extend( $[propOrAttr+'Hooks'].disabled, {
2828+
set: function( elem, value, name ) {
2829+
$(elem).toggleClass('disabled', !!value);
28562830

2857-
// This is a patch that so that if you disable an element, that it also gives it the class disabled.
2858-
// that way you can add css classes for our friend IE6. so rather than using selector:disabled, you can do selector.disabled.
2859-
// I patch the $.attr method, not the $.fn.attr method because both $.fn.attr and $.fn.removeAttr use $.attr.
2860-
// which means that it will get run trough this both when you disable AND remove the 'disabled' attribute on an element.
2861-
$.attrBeforeHandlingDisabled = $.attr;
2862-
$.attr = function( elem, name, value, pass ){
2863-
if(typeof(name) === "string" && name.toLowerCase() === 'disabled' && value !== undefined) {
2864-
$(elem)[(value ? "add" : "remove") + "Class"]('disabled');
2865-
}
2866-
return $.attrBeforeHandlingDisabled.apply(this, arguments);
2867-
};
2868-
2831+
// have to replicate wat jQuery's boolHook does because once you define your own hook
2832+
// for an attribute/property it wont fall back to boolHook. and it is not exposed externally.
2833+
elem[value ? 'setAttribute' : 'removeAttribute' ]('disabled', 'disabled');
2834+
if ( 'disabled' in elem ) {
2835+
// Only set the IDL specifically if it already exists on the element
2836+
// ie for an <input> but not a <div>
2837+
elem.disabled = !!value;
2838+
}
2839+
return value;
2840+
}
2841+
});
2842+
});
2843+
28692844
// this is a patch so you can set the "method" atribute on rails' REST-ful forms.
2870-
$.attrBeforeHandlingFormMethod = $.attr;
2871-
$.attr = function( elem, name, value, pass ) {
2872-
// if it's an html node and if we are trying to set the 'method' attribute
2873-
if ( elem && value && typeof(name) === "string" && name.toLowerCase() == 'method') {
2845+
$.attrHooks.method = $.extend($.attrHooks.method, {
2846+
set: function( elem, value ) {
28742847
var orginalVal = value;
28752848
value = value.toUpperCase() === 'GET' ? 'GET' : 'POST';
28762849
if ( value === 'POST' ) {
@@ -2880,10 +2853,10 @@ I18n.scoped('instructure', function(I18n) {
28802853
}
28812854
$input.val(orginalVal);
28822855
}
2856+
elem.setAttribute('method', value);
2857+
return value;
28832858
}
2884-
// can't do .apply because we need to pas the NEW 'value' that we set above, not the one in 'arguments'
2885-
return $.attrBeforeHandlingFormMethod.call( this, elem, name, value, pass );
2886-
};
2859+
});
28872860

28882861
$.fn.indicate = function(options) {
28892862
options = options || {};

0 commit comments

Comments
 (0)