Issue #1799594 by nod_, Wim Leers, jessebeach, jcisio: Update to jQuery 1.9 version.

8.0.x
webchick 2013-04-09 13:58:51 -07:00
parent 95516e65b7
commit dd85e54ab1
27 changed files with 4518 additions and 3002 deletions

View File

@ -390,7 +390,7 @@ Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) {
// interaction while the Ajax request is in progress. ajax.ajaxing prevents
// the element from triggering a new request, but does not prevent the user
// from changing its value.
$(this.element).addClass('progress-disabled').attr('disabled', true);
$(this.element).addClass('progress-disabled').prop('disabled', true);
// Insert progressbar or throbber.
if (this.progress.type === 'bar') {
@ -425,7 +425,7 @@ Drupal.ajax.prototype.success = function (response, status) {
if (this.progress.object) {
this.progress.object.stopMonitoring();
}
$(this.element).removeClass('progress-disabled').removeAttr('disabled');
$(this.element).removeClass('progress-disabled').prop('disabled', false);
Drupal.freezeHeight();
@ -493,7 +493,7 @@ Drupal.ajax.prototype.error = function (response, uri) {
// Undo hide.
$(this.wrapper).show();
// Re-enable the element.
$(this.element).removeClass('progress-disabled').removeAttr('disabled');
$(this.element).removeClass('progress-disabled').prop('disabled', false);
// Reattach behaviors, if they were detached in beforeSerialize().
if (this.form) {
var settings = response.settings || this.settings || Drupal.settings;

View File

@ -14,7 +14,7 @@ Drupal.behaviors.autocomplete = {
acdb[uri] = new Drupal.ACDB(uri);
}
var $input = $('#' + this.id.substr(0, this.id.length - 13))
.attr('autocomplete', 'OFF')
.prop('autocomplete', 'OFF')
.attr('aria-autocomplete', 'list');
$($input[0].form).submit(Drupal.autocompleteSubmit);
$input.parent()

View File

@ -53,7 +53,7 @@ function CollapsibleDetails(node, settings) {
// element that is targeted by the URI fragment identifier.
var anchor = location.hash && location.hash !== '#' ? ', ' + location.hash : '';
if (this.$node.find('.error' + anchor).length) {
this.$node.attr('open', true);
this.$node.prop('open', true);
}
// Initialize and setup the summary,
this.setupSummary();
@ -96,7 +96,7 @@ $.extend(CollapsibleDetails.prototype, {
var $legend = this.$node.find('> summary');
$('<span class="details-summary-prefix element-invisible"></span>')
.append(this.$node.attr('open') ? Drupal.t('Hide') : Drupal.t('Show'))
.append(this.$node.prop('open') ? Drupal.t('Hide') : Drupal.t('Show'))
.prependTo($legend)
.after(' ');
@ -129,7 +129,7 @@ $.extend(CollapsibleDetails.prototype, {
if (this.animating) {
return;
}
if (!this.$node.attr('open')) {
if (!this.$node.prop('open')) {
var $content = this.$node.find('> .details-wrapper').hide();
this.$node
.trigger({ type:'collapsed', value:false })
@ -153,7 +153,7 @@ $.extend(CollapsibleDetails.prototype, {
* Completed opening details element.
*/
onCompleteSlideDown: function () {
this.$node.attr('open', true);
this.$node.prop('open', true);
this.$node.trigger('completeSlideDown');
this.animating = false;
},
@ -161,7 +161,7 @@ $.extend(CollapsibleDetails.prototype, {
* Completed closing details element.
*/
onCompleteSlideUp: function () {
this.$node.attr('open', false);
this.$node.prop('open', false);
this.$node
.find('> summary span.details-summary-prefix').html(Drupal.t('Show'));
this.$node.trigger('completeSlideUp');

View File

@ -261,65 +261,62 @@ Drupal.t = function (str, args, options) {
/**
* Adds an HTML element and method to trigger audio UAs to read system messages.
*/
(function (document, Drupal) {
var liveElement;
var liveElement;
/**
* Builds a div element with the aria-live attribute and attaches it
* to the DOM.
*/
Drupal.behaviors.drupalAnnounce = {
attach: function (settings, context) {
liveElement = document.createElement('div');
liveElement.id = 'drupal-live-announce';
liveElement.className = 'element-invisible';
liveElement.setAttribute('aria-live', 'polite');
liveElement.setAttribute('aria-busy', 'false');
document.body.appendChild(liveElement);
}
};
/**
* Builds a div element with the aria-live attribute and attaches it
* to the DOM.
*/
Drupal.behaviors.drupalAnnounce = {
attach: function (settings, context) {
liveElement = document.createElement('div');
liveElement.id = 'drupal-live-announce';
liveElement.className = 'element-invisible';
liveElement.setAttribute('aria-live', 'polite');
liveElement.setAttribute('aria-busy', 'false');
document.body.appendChild(liveElement);
}
};
/**
* Triggers audio UAs to read the supplied text.
*
* @param {String} text
* - A string to be read by the UA.
*
* @param {String} priority
* - A string to indicate the priority of the message. Can be either
* 'polite' or 'assertive'. Polite is the default.
*
* Use Drupal.announce to indicate to screen reader users that an element on
* the page has changed state. For instance, if clicking a link loads 10 more
* items into a list, one might announce the change like this.
* $('#search-list')
* .on('itemInsert', function (event, data) {
* // Insert the new items.
* $(data.container.el).append(data.items.el);
* // Announce the change to the page contents.
* Drupal.announce(Drupal.t('@count items added to @container',
* {'@count': data.items.length, '@container': data.container.title}
* ));
* });
*
* @see http://www.w3.org/WAI/PF/aria-practices/#liveprops
*/
Drupal.announce = function (text, priority) {
if (typeof text === 'string') {
// Clear the liveElement so that repeated strings will be read.
liveElement.innerHTML = '';
// Set the busy state to true until the node changes are complete.
liveElement.setAttribute('aria-busy', 'true');
// Set the priority to assertive, or default to polite.
liveElement.setAttribute('aria-live', (priority === 'assertive') ? 'assertive' : 'polite');
// Print the text to the live region.
liveElement.innerHTML = Drupal.checkPlain(text);
// The live text area is updated. Allow the AT to announce the text.
liveElement.setAttribute('aria-busy', 'false');
}
};
}(document, Drupal));
/**
* Triggers audio UAs to read the supplied text.
*
* @param {String} text
* - A string to be read by the UA.
*
* @param {String} priority
* - A string to indicate the priority of the message. Can be either
* 'polite' or 'assertive'. Polite is the default.
*
* Use Drupal.announce to indicate to screen reader users that an element on
* the page has changed state. For instance, if clicking a link loads 10 more
* items into a list, one might announce the change like this.
* $('#search-list')
* .on('itemInsert', function (event, data) {
* // Insert the new items.
* $(data.container.el).append(data.items.el);
* // Announce the change to the page contents.
* Drupal.announce(Drupal.t('@count items added to @container',
* {'@count': data.items.length, '@container': data.container.title}
* ));
* });
*
* @see http://www.w3.org/WAI/PF/aria-practices/#liveprops
*/
Drupal.announce = function (text, priority) {
if (typeof text === 'string') {
// Clear the liveElement so that repeated strings will be read.
liveElement.innerHTML = '';
// Set the busy state to true until the node changes are complete.
liveElement.setAttribute('aria-busy', 'true');
// Set the priority to assertive, or default to polite.
liveElement.setAttribute('aria-live', (priority === 'assertive') ? 'assertive' : 'polite');
// Print the text to the live region.
liveElement.innerHTML = Drupal.checkPlain(text);
// The live text area is updated. Allow the AT to announce the text.
liveElement.setAttribute('aria-busy', 'false');
}
};
/**
* Returns the URL to a Drupal page.

File diff suppressed because it is too large Load Diff

5899
core/misc/jquery.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -505,9 +505,9 @@ $(document).bind('state:disabled', function(e) {
// element monitoring itself.
if (e.trigger) {
$(e.target)
.attr('disabled', e.value)
.prop('disabled', e.value)
.closest('.form-item, .form-submit, .form-wrapper').toggleClass('form-disabled', e.value)
.find('select, input, textarea').attr('disabled', e.value);
.find('select, input, textarea').prop('disabled', e.value);
// Note: WebKit nightlies don't reflect that change correctly.
// See https://bugs.webkit.org/show_bug.cgi?id=23789
@ -533,7 +533,7 @@ $(document).bind('state:visible', function(e) {
$(document).bind('state:checked', function(e) {
if (e.trigger) {
$(e.target).attr('checked', e.value);
$(e.target).prop('checked', e.value);
}
});

View File

@ -36,9 +36,7 @@ function TableResponsive (table) {
this.$headers = this.$table.find('th');
// Add a link before the table for users to show or hide weight columns.
this.$link = $('<a href="#" class="tableresponsive-toggle"></a>')
.attr({
'title': Drupal.t('Show table cells that were hidden to make the table fit within a small screen.')
})
.attr('title', Drupal.t('Show table cells that were hidden to make the table fit within a small screen.'))
.on('click', $.proxy(this, 'eventhandlerToggleColumns'));
this.$table.before($('<div class="tableresponsive-toggle-columns"></div>').append(this.$link));

View File

@ -75,7 +75,7 @@ Drupal.tableSelectRange = function (from, to, state) {
$i = $(i);
// Either add or remove the selected class based on the state of the target checkbox.
$i.toggleClass('selected', state);
$i.find('input[type="checkbox"]').attr('checked', state);
$i.find('input[type="checkbox"]').prop('checked', state);
if (to.nodeType) {
// If we are at the end of the range, stop.

View File

@ -45,7 +45,7 @@ Drupal.behaviors.verticalTabs = {
tab_list.append(vertical_tab.item);
$this
.removeClass('collapsed')
.attr('open', true)
.prop('open', true)
.addClass('vertical-tabs-pane')
.data('verticalTab', vertical_tab);
if (this.id === focusID) {

View File

@ -209,8 +209,9 @@ Drupal.behaviors.color = {
// Add lock.
var i = inputs.length;
if (inputs.length) {
var lock = $('<div class="lock"></div>').toggle(
function () {
var toggleClick = true;
var lock = $('<div class="lock"></div>').on('click', function () {
if (toggleClick) {
$(this).addClass('unlocked');
$(hooks[i - 1]).attr('class',
locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook up' : 'hook'
@ -218,8 +219,8 @@ Drupal.behaviors.color = {
$(hooks[i]).attr('class',
locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook down' : 'hook'
);
},
function () {
}
else {
$(this).removeClass('unlocked');
$(hooks[i - 1]).attr('class',
locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook both' : 'hook down'
@ -228,7 +229,8 @@ Drupal.behaviors.color = {
locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook both' : 'hook up'
);
}
);
toggleClick = !toggleClick;
});
$(this).after(lock);
locks.push(lock);
}

View File

@ -90,10 +90,8 @@ Drupal.contextual.prototype.init = function() {
// Mark the links as hidden. Use aria-role form so that the number of items
// in the list is spoken.
this.$links
.attr({
'hidden': 'hidden',
'role': 'form'
});
.prop('hidden', true)
.attr('role', 'form');
// Create and append the contextual links trigger.
var action = Drupal.t('Open');
@ -102,7 +100,7 @@ Drupal.contextual.prototype.init = function() {
this.$trigger = $(Drupal.theme.contextualTrigger())
.text(Drupal.t('@action @parent configuration options', {'@action': action, '@parent': parentBlock}))
// Set the aria-pressed state.
.attr('aria-pressed', false)
.prop('aria-pressed', false)
.prependTo(this.$wrapper);
// The trigger behaviors are never detached or mutated.
@ -201,13 +199,13 @@ Drupal.contextual.prototype.showLinks = function(show) {
this.$trigger
.text(Drupal.t('@action @parent configuration options', {'@action': action, '@parent': parentBlock}))
// Set the aria-pressed state.
.attr('aria-pressed', isOpen);
.prop('aria-pressed', isOpen);
// Mark the links as hidden if they are.
if (isOpen) {
this.$links.removeAttr('hidden');
this.$links.prop('hidden', false);
}
else {
this.$links.attr('hidden', 'hidden');
this.$links.prop('hidden', true);
}
};

View File

@ -97,7 +97,7 @@ Drupal.contextualToolbar.views.EditToggleView = Backbone.View.extend({
var isViewing = this.model.get('isViewing');
this.$el.find('button')
.toggleClass('active', !isViewing)
.attr('aria-pressed', !isViewing);
.prop('aria-pressed', !isViewing);
return this;
},

View File

@ -119,7 +119,7 @@ Backbone.syncDirect = function(method, model, options) {
// side validation. (Not disabling this will actually cause problems
// because browsers don't like to set HTML5 validation errors on hidden
// forms.)
jQuery('#edit_backstage form').attr('novalidate', true);
jQuery('#edit_backstage form').prop('novalidate', true);
var $submit = jQuery('#edit_backstage form .edit-form-submit');
var base = Drupal.edit.util.form.ajaxifySaving(formOptions, $submit);

View File

@ -261,7 +261,7 @@ Drupal.fieldUIOverview = {
// Disabled elements do not appear in POST ajax data, so we mark the
// elements disabled only after firing the request.
$(ajaxElements).attr('disabled', true);
$(ajaxElements).prop('disabled', true);
}
}
};

View File

@ -130,7 +130,7 @@ Drupal.file = Drupal.file || {
// don't have to worry about the fields being re-enabled too soon.
// @todo If the previous sentence is true, why not set the timeout to 0?
var $fieldsToTemporarilyDisable = $('div.form-managed-file input.form-file').not($enabledFields).not(':disabled');
$fieldsToTemporarilyDisable.attr('disabled', 'disabled');
$fieldsToTemporarilyDisable.prop('disabled', true);
setTimeout(function (){
$fieldsToTemporarilyDisable.prop('disabled', false);
}, 1000);

View File

@ -21,22 +21,24 @@ Drupal.behaviors.openid = {
var $openid_form = $('#openid-login-form');
// Change link text and triggers loginchange event.
$('#block-user-login .openid-link').toggle(
function() {
var toggleClick = true;
$('#block-user-login .openid-link').on('click', function() {
if (toggleClick) {
$(this).html(Drupal.t('Cancel OpenID login'));
$login_form.hide();
$openid_form.show();
clearStatus($login_form);
// Move focus to OpenID input.
$('#edit-openid-identifier').focus();
},
function() {
}
else {
$(this).html(Drupal.t('Log in using OpenID'));
$login_form.show();
$openid_form.hide();
clearStatus($openid_form);
}
);
toggleClick = !toggleClick;
});
}
}

View File

@ -286,7 +286,7 @@ Drupal.overlay.loadChild = function (event) {
this.isLoading = false;
$(document.documentElement).removeClass('overlay-loading');
event.data.sibling.removeClass('overlay-active').attr({ 'tabindex': -1 });
event.data.sibling.removeClass('overlay-active').prop({ 'tabindex': -1 });
// Only continue when overlay is still open and not closing.
if (this.isOpen && !this.isClosing) {
@ -298,7 +298,7 @@ Drupal.overlay.loadChild = function (event) {
this.activeFrame = $(iframe)
.addClass('overlay-active')
// Add a title attribute to the iframe for accessibility.
.attr('title', Drupal.t('@title dialog', { '@title': iframeWindow.jQuery('#overlay-title').text() })).removeAttr('tabindex');
.attr('title', Drupal.t('@title dialog', { '@title': iframeWindow.jQuery('#overlay-title').text() })).prop('tabindex', false);
this.inactiveFrame = event.data.sibling;
// Load an empty document into the inactive iframe.
@ -863,7 +863,7 @@ Drupal.overlay.makeDocumentUntabbable = function (context) {
$tabbable = $tabbable.not($overlay);
// We now have a list of everything in the underlying document that could
// possibly be reachable via the tab key. Make it all unreachable.
$tabbable.attr('tabindex', -1);
$tabbable.prop('tabindex', -1);
};
/**
@ -879,7 +879,7 @@ Drupal.overlay.makeDocumentTabbable = function (context) {
// Make the underlying document tabbable again by removing all existing
// tabindex attributes.
$('[tabindex]', context).removeAttr('tabindex');
$(context).find('[tabindex]').prop('tabindex', false);
// Restore the tabindex attributes that existed before the overlay was opened.
$needsTabindex = $(Drupal.overlay._hasTabindex, context);
@ -894,7 +894,7 @@ Drupal.overlay.makeDocumentTabbable = function (context) {
*/
Drupal.overlay._recordTabindex = function () {
var $element = $(this);
var tabindex = $(this).attr('tabindex');
var tabindex = $(this).prop('tabindex');
$element.data('drupalOverlayOriginalTabIndex', tabindex);
};
@ -906,7 +906,7 @@ Drupal.overlay._recordTabindex = function () {
Drupal.overlay._restoreTabindex = function () {
var $element = $(this);
var tabindex = $element.data('drupalOverlayOriginalTabIndex');
$element.attr('tabindex', tabindex);
$element.prop('tabindex', tabindex);
};
$.extend(Drupal.theme, {

View File

@ -9,7 +9,7 @@
Drupal.behaviors.newSet = {
attach: function (context, settings) {
var selectDefault = function() {
$(this).closest('form').find('.form-item-set .form-type-radio:last input').attr('checked', 'checked');
$(this).closest('form').find('.form-item-set .form-type-radio:last input').prop('checked', true);
};
$('div.form-item-new input').focus(selectDefault).keyup(selectDefault);
}

View File

@ -1434,7 +1434,7 @@ function system_library_info() {
$libraries['jquery'] = array(
'title' => 'jQuery',
'website' => 'http://jquery.com',
'version' => '1.8.2',
'version' => '1.9.1',
'js' => array(
'core/misc/jquery.js' => array('group' => JS_LIBRARY, 'weight' => -20),
),
@ -1471,7 +1471,7 @@ function system_library_info() {
$libraries['jquery.bbq'] = array(
'title' => 'jQuery BBQ',
'website' => 'http://benalman.com/projects/jquery-bbq-plugin/',
'version' => '1.2.1',
'version' => '1.3pre',
'js' => array(
'core/misc/jquery.ba-bbq.js' => array(),
),

View File

@ -24,20 +24,21 @@ Drupal.behaviors.textSummary = {
// Set up the edit/hide summary link.
var $link = $('<span class="field-edit-link">(<a class="link-edit-summary" href="#nogo">' + Drupal.t('Hide summary') + '</a>)</span>');
var $a = $link.find('a');
$link.toggle(
function (e) {
e.preventDefault();
var toggleClick = true;
$link.on('click', function (e) {
if (toggleClick) {
$summary.hide();
$a.html(Drupal.t('Edit summary'));
$link.appendTo($fullLabel);
},
function (e) {
e.preventDefault();
}
else {
$summary.show();
$a.html(Drupal.t('Hide summary'));
$link.appendTo($summaryLabel);
}
).appendTo($summaryLabel);
e.preventDefault();
toggleClick = !toggleClick;
}).appendTo($summaryLabel);
// If no summary is set, hide the summary field.
if ($widget.find('.text-summary').val() === '') {

View File

@ -136,8 +136,8 @@ Drupal.toolbar.toggleTray = function (event) {
event.stopPropagation();
$tab.toggleClass('active');
// Toggle aria-pressed.
var value = $tab.attr('aria-pressed');
$tab.attr('aria-pressed', (value === 'false') ? 'true' : 'false');
var value = $tab.prop('aria-pressed');
$tab.prop('aria-pressed', (value === 'false') ? 'true' : 'false');
// Append a message that a tray has been opened.
setMessage(Drupal.t('@tray tray @state.', {
'@tray': name,
@ -155,7 +155,7 @@ Drupal.toolbar.toggleTray = function (event) {
.not($tab)
.removeClass('active')
// Set aria-pressed to false.
.attr('aria-pressed', 'false');
.prop('aria-pressed', false);
$toolbar.find('.tray').not($activateTray).removeClass('active');
}
// Update the page and toolbar dimension indicators.

View File

@ -102,7 +102,7 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
var isActive = this.model.get('isActive');
this.$el.find('button')
.toggleClass('active', isActive)
.attr('aria-pressed', isActive);
.prop('aria-pressed', isActive);
return this;
},
@ -201,4 +201,4 @@ Drupal.tour.views.ToggleTourView = Backbone.View.extend({
});
})(jQuery, Backbone, Drupal, document);
})(jQuery, Backbone, Drupal, document);

View File

@ -7,9 +7,9 @@ Drupal.behaviors.TranslationEnable = {
$('#edit-node-type-language-default, #edit-node-type-language-hidden', context).change(function(context) {
var default_language = $('#edit-node-type-language-default').val();
if ((default_language === 'und' || default_language === 'zxx' || default_language === 'mul') && $('#edit-node-type-language-hidden').attr('checked')) {
if ((default_language === 'und' || default_language === 'zxx' || default_language === 'mul') && $('#edit-node-type-language-hidden').prop('checked')) {
$('.form-item-node-type-language-translation-enabled').hide();
$('#edit-node-type-language-translation-enabled').removeAttr('checked');
$('#edit-node-type-language-translation-enabled').prop('checked', false);
} else {
$('.form-item-node-type-language-translation-enabled').show();
}

View File

@ -82,8 +82,8 @@ Drupal.behaviors.translationEntity = {
var $settings = $bundleSettings.nextUntil('.bundle-settings');
var $fieldSettings = $settings.filter('.field-settings');
if ($target.is(':checked')) {
$bundleSettings.find('.operations :input[name$="[language_show]"]').attr('checked', true);
$fieldSettings.find('.translatable :input').attr('checked', true);
$bundleSettings.find('.operations :input[name$="[language_show]"]').prop('checked', true);
$fieldSettings.find('.translatable :input').prop('checked', true);
$settings.show();
}
else {

View File

@ -182,8 +182,8 @@ Drupal.behaviors.fieldUserRegistration = {
if ($checkbox.length) {
$(context).find('input#edit-instance-required').once('user-register-form-checkbox', function () {
$(this).bind('change', function (e) {
if ($(this).attr('checked')) {
$checkbox.attr('checked', true);
if ($(this).prop('checked')) {
$checkbox.prop('checked', true);
}
});
});

View File

@ -869,7 +869,7 @@ Drupal.behaviors.viewsFilterConfigSelectAll.attach = function(context) {
$('#views-ui-config-item-form div.form-type-checkbox').not($('.form-item-options-value-all')).find('input[type=checkbox]').each(function() {
$(this).click(function() {
if ($(this).is('checked') === false) {
$('#edit-options-value-all').removeAttr('checked');
$('#edit-options-value-all').prop('checked', false);
}
});
});