MCPcopy Create free account
hub / github.com/kkroening/ffmpeg-python / createDisabledPseudo

Function createDisabledPseudo

doc/html/_static/jquery-3.2.1.js:1005–1055  ·  view source on GitHub ↗

* Returns a function to use in pseudos for :enabled/:disabled * @param {Boolean} disabled true for :disabled; false for :enabled

( disabled )

Source from the content-addressed store, hash-verified

1003 * @param {Boolean} disabled true for :disabled; false for :enabled
1004 */
1005function createDisabledPseudo( disabled ) {
1006
1007 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1008 return function( elem ) {
1009
1010 // Only certain elements can match :enabled or :disabled
1011 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1012 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1013 if ( "form" in elem ) {
1014
1015 // Check for inherited disabledness on relevant non-disabled elements:
1016 // * listed form-associated elements in a disabled fieldset
1017 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
1018 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1019 // * option elements in a disabled optgroup
1020 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1021 // All such elements have a "form" property.
1022 if ( elem.parentNode && elem.disabled === false ) {
1023
1024 // Option elements defer to a parent optgroup if present
1025 if ( "label" in elem ) {
1026 if ( "label" in elem.parentNode ) {
1027 return elem.parentNode.disabled === disabled;
1028 } else {
1029 return elem.disabled === disabled;
1030 }
1031 }
1032
1033 // Support: IE 6 - 11
1034 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1035 return elem.isDisabled === disabled ||
1036
1037 // Where there is no isDisabled, check manually
1038 /* jshint -W018 */
1039 elem.isDisabled !== !disabled &&
1040 disabledAncestor( elem ) === disabled;
1041 }
1042
1043 return elem.disabled === disabled;
1044
1045 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1046 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1047 // even exist on them, let alone have a boolean value.
1048 } else if ( "label" in elem ) {
1049 return elem.disabled === disabled;
1050 }
1051
1052 // Remaining elements are neither :enabled nor :disabled
1053 return false;
1054 };
1055}
1056
1057/**
1058 * Returns a function to use in pseudos for positionals

Callers 1

jquery-3.2.1.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…