root / drupal7 / sites / all / themes / bootstrap / js / misc / states.js @ 024de6ea
1 |
(function($) { |
---|---|
2 |
// Unbind core state.js from document first so we can then override below.
|
3 |
$(document).unbind('state:disabled'); |
4 |
|
5 |
/**
|
6 |
* Global state change handlers. These are bound to "document" to cover all
|
7 |
* elements whose state changes. Events sent to elements within the page
|
8 |
* bubble up to these handlers. We use this system so that themes and modules
|
9 |
* can override these state change handlers for particular parts of a page.
|
10 |
*/
|
11 |
$(document).bind('state:disabled', function(e) { |
12 |
// Only act when this change was triggered by a dependency and not by the
|
13 |
// element monitoring itself.
|
14 |
if (e.trigger) {
|
15 |
$(e.target)
|
16 |
.attr('disabled', e.value)
|
17 |
.closest('.form-item, .form-submit, .form-wrapper').toggleClass('form-disabled', e.value) |
18 |
.find(':input').attr('disabled', e.value); |
19 |
|
20 |
// Note: WebKit nightlies don't reflect that change correctly.
|
21 |
// See https://bugs.webkit.org/show_bug.cgi?id=23789
|
22 |
} |
23 |
}); |
24 |
})(jQuery); |