checkbox.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. /*!
  2. * # Semantic UI 2.4.2 - Checkbox
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Released under the MIT license
  7. * http://opensource.org/licenses/MIT
  8. *
  9. */
  10. ;(function ($, window, document, undefined) {
  11. 'use strict';
  12. window = (typeof window != 'undefined' && window.Math == Math)
  13. ? window
  14. : (typeof self != 'undefined' && self.Math == Math)
  15. ? self
  16. : Function('return this')()
  17. ;
  18. $.fn.checkbox = function(parameters) {
  19. var
  20. $allModules = $(this),
  21. moduleSelector = $allModules.selector || '',
  22. time = new Date().getTime(),
  23. performance = [],
  24. query = arguments[0],
  25. methodInvoked = (typeof query == 'string'),
  26. queryArguments = [].slice.call(arguments, 1),
  27. returnedValue
  28. ;
  29. $allModules
  30. .each(function() {
  31. var
  32. settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
  33. className = settings.className,
  34. namespace = settings.namespace,
  35. selector = settings.selector,
  36. error = settings.error,
  37. eventNamespace = '.' + namespace,
  38. moduleNamespace = 'module-' + namespace,
  39. $module = $(this),
  40. $label = $(this).children(selector.label),
  41. $input = $(this).children(selector.input),
  42. input = $input[0],
  43. initialLoad = false,
  44. shortcutPressed = false,
  45. instance = $module.data(moduleNamespace),
  46. observer,
  47. element = this,
  48. module
  49. ;
  50. module = {
  51. initialize: function() {
  52. module.verbose('Initializing checkbox', settings);
  53. module.create.label();
  54. module.bind.events();
  55. module.set.tabbable();
  56. module.hide.input();
  57. module.observeChanges();
  58. module.instantiate();
  59. module.setup();
  60. },
  61. instantiate: function() {
  62. module.verbose('Storing instance of module', module);
  63. instance = module;
  64. $module
  65. .data(moduleNamespace, module)
  66. ;
  67. },
  68. destroy: function() {
  69. module.verbose('Destroying module');
  70. module.unbind.events();
  71. module.show.input();
  72. $module.removeData(moduleNamespace);
  73. },
  74. fix: {
  75. reference: function() {
  76. if( $module.is(selector.input) ) {
  77. module.debug('Behavior called on <input> adjusting invoked element');
  78. $module = $module.closest(selector.checkbox);
  79. module.refresh();
  80. }
  81. }
  82. },
  83. setup: function() {
  84. module.set.initialLoad();
  85. if( module.is.indeterminate() ) {
  86. module.debug('Initial value is indeterminate');
  87. module.indeterminate();
  88. }
  89. else if( module.is.checked() ) {
  90. module.debug('Initial value is checked');
  91. module.check();
  92. }
  93. else {
  94. module.debug('Initial value is unchecked');
  95. module.uncheck();
  96. }
  97. module.remove.initialLoad();
  98. },
  99. refresh: function() {
  100. $label = $module.children(selector.label);
  101. $input = $module.children(selector.input);
  102. input = $input[0];
  103. },
  104. hide: {
  105. input: function() {
  106. module.verbose('Modifying <input> z-index to be unselectable');
  107. $input.addClass(className.hidden);
  108. }
  109. },
  110. show: {
  111. input: function() {
  112. module.verbose('Modifying <input> z-index to be selectable');
  113. $input.removeClass(className.hidden);
  114. }
  115. },
  116. observeChanges: function() {
  117. if('MutationObserver' in window) {
  118. observer = new MutationObserver(function(mutations) {
  119. module.debug('DOM tree modified, updating selector cache');
  120. module.refresh();
  121. });
  122. observer.observe(element, {
  123. childList : true,
  124. subtree : true
  125. });
  126. module.debug('Setting up mutation observer', observer);
  127. }
  128. },
  129. attachEvents: function(selector, event) {
  130. var
  131. $element = $(selector)
  132. ;
  133. event = $.isFunction(module[event])
  134. ? module[event]
  135. : module.toggle
  136. ;
  137. if($element.length > 0) {
  138. module.debug('Attaching checkbox events to element', selector, event);
  139. $element
  140. .on('click' + eventNamespace, event)
  141. ;
  142. }
  143. else {
  144. module.error(error.notFound);
  145. }
  146. },
  147. event: {
  148. click: function(event) {
  149. var
  150. $target = $(event.target)
  151. ;
  152. if( $target.is(selector.input) ) {
  153. module.verbose('Using default check action on initialized checkbox');
  154. return;
  155. }
  156. if( $target.is(selector.link) ) {
  157. module.debug('Clicking link inside checkbox, skipping toggle');
  158. return;
  159. }
  160. module.toggle();
  161. $input.focus();
  162. event.preventDefault();
  163. },
  164. keydown: function(event) {
  165. var
  166. key = event.which,
  167. keyCode = {
  168. enter : 13,
  169. space : 32,
  170. escape : 27
  171. }
  172. ;
  173. if(key == keyCode.escape) {
  174. module.verbose('Escape key pressed blurring field');
  175. $input.blur();
  176. shortcutPressed = true;
  177. }
  178. else if(!event.ctrlKey && ( key == keyCode.space || key == keyCode.enter) ) {
  179. module.verbose('Enter/space key pressed, toggling checkbox');
  180. module.toggle();
  181. shortcutPressed = true;
  182. }
  183. else {
  184. shortcutPressed = false;
  185. }
  186. },
  187. keyup: function(event) {
  188. if(shortcutPressed) {
  189. event.preventDefault();
  190. }
  191. }
  192. },
  193. check: function() {
  194. if( !module.should.allowCheck() ) {
  195. return;
  196. }
  197. module.debug('Checking checkbox', $input);
  198. module.set.checked();
  199. if( !module.should.ignoreCallbacks() ) {
  200. settings.onChecked.call(input);
  201. settings.onChange.call(input);
  202. }
  203. },
  204. uncheck: function() {
  205. if( !module.should.allowUncheck() ) {
  206. return;
  207. }
  208. module.debug('Unchecking checkbox');
  209. module.set.unchecked();
  210. if( !module.should.ignoreCallbacks() ) {
  211. settings.onUnchecked.call(input);
  212. settings.onChange.call(input);
  213. }
  214. },
  215. indeterminate: function() {
  216. if( module.should.allowIndeterminate() ) {
  217. module.debug('Checkbox is already indeterminate');
  218. return;
  219. }
  220. module.debug('Making checkbox indeterminate');
  221. module.set.indeterminate();
  222. if( !module.should.ignoreCallbacks() ) {
  223. settings.onIndeterminate.call(input);
  224. settings.onChange.call(input);
  225. }
  226. },
  227. determinate: function() {
  228. if( module.should.allowDeterminate() ) {
  229. module.debug('Checkbox is already determinate');
  230. return;
  231. }
  232. module.debug('Making checkbox determinate');
  233. module.set.determinate();
  234. if( !module.should.ignoreCallbacks() ) {
  235. settings.onDeterminate.call(input);
  236. settings.onChange.call(input);
  237. }
  238. },
  239. enable: function() {
  240. if( module.is.enabled() ) {
  241. module.debug('Checkbox is already enabled');
  242. return;
  243. }
  244. module.debug('Enabling checkbox');
  245. module.set.enabled();
  246. settings.onEnable.call(input);
  247. // preserve legacy callbacks
  248. settings.onEnabled.call(input);
  249. },
  250. disable: function() {
  251. if( module.is.disabled() ) {
  252. module.debug('Checkbox is already disabled');
  253. return;
  254. }
  255. module.debug('Disabling checkbox');
  256. module.set.disabled();
  257. settings.onDisable.call(input);
  258. // preserve legacy callbacks
  259. settings.onDisabled.call(input);
  260. },
  261. get: {
  262. radios: function() {
  263. var
  264. name = module.get.name()
  265. ;
  266. return $('input[name="' + name + '"]').closest(selector.checkbox);
  267. },
  268. otherRadios: function() {
  269. return module.get.radios().not($module);
  270. },
  271. name: function() {
  272. return $input.attr('name');
  273. }
  274. },
  275. is: {
  276. initialLoad: function() {
  277. return initialLoad;
  278. },
  279. radio: function() {
  280. return ($input.hasClass(className.radio) || $input.attr('type') == 'radio');
  281. },
  282. indeterminate: function() {
  283. return $input.prop('indeterminate') !== undefined && $input.prop('indeterminate');
  284. },
  285. checked: function() {
  286. return $input.prop('checked') !== undefined && $input.prop('checked');
  287. },
  288. disabled: function() {
  289. return $input.prop('disabled') !== undefined && $input.prop('disabled');
  290. },
  291. enabled: function() {
  292. return !module.is.disabled();
  293. },
  294. determinate: function() {
  295. return !module.is.indeterminate();
  296. },
  297. unchecked: function() {
  298. return !module.is.checked();
  299. }
  300. },
  301. should: {
  302. allowCheck: function() {
  303. if(module.is.determinate() && module.is.checked() && !module.should.forceCallbacks() ) {
  304. module.debug('Should not allow check, checkbox is already checked');
  305. return false;
  306. }
  307. if(settings.beforeChecked.apply(input) === false) {
  308. module.debug('Should not allow check, beforeChecked cancelled');
  309. return false;
  310. }
  311. return true;
  312. },
  313. allowUncheck: function() {
  314. if(module.is.determinate() && module.is.unchecked() && !module.should.forceCallbacks() ) {
  315. module.debug('Should not allow uncheck, checkbox is already unchecked');
  316. return false;
  317. }
  318. if(settings.beforeUnchecked.apply(input) === false) {
  319. module.debug('Should not allow uncheck, beforeUnchecked cancelled');
  320. return false;
  321. }
  322. return true;
  323. },
  324. allowIndeterminate: function() {
  325. if(module.is.indeterminate() && !module.should.forceCallbacks() ) {
  326. module.debug('Should not allow indeterminate, checkbox is already indeterminate');
  327. return false;
  328. }
  329. if(settings.beforeIndeterminate.apply(input) === false) {
  330. module.debug('Should not allow indeterminate, beforeIndeterminate cancelled');
  331. return false;
  332. }
  333. return true;
  334. },
  335. allowDeterminate: function() {
  336. if(module.is.determinate() && !module.should.forceCallbacks() ) {
  337. module.debug('Should not allow determinate, checkbox is already determinate');
  338. return false;
  339. }
  340. if(settings.beforeDeterminate.apply(input) === false) {
  341. module.debug('Should not allow determinate, beforeDeterminate cancelled');
  342. return false;
  343. }
  344. return true;
  345. },
  346. forceCallbacks: function() {
  347. return (module.is.initialLoad() && settings.fireOnInit);
  348. },
  349. ignoreCallbacks: function() {
  350. return (initialLoad && !settings.fireOnInit);
  351. }
  352. },
  353. can: {
  354. change: function() {
  355. return !( $module.hasClass(className.disabled) || $module.hasClass(className.readOnly) || $input.prop('disabled') || $input.prop('readonly') );
  356. },
  357. uncheck: function() {
  358. return (typeof settings.uncheckable === 'boolean')
  359. ? settings.uncheckable
  360. : !module.is.radio()
  361. ;
  362. }
  363. },
  364. set: {
  365. initialLoad: function() {
  366. initialLoad = true;
  367. },
  368. checked: function() {
  369. module.verbose('Setting class to checked');
  370. $module
  371. .removeClass(className.indeterminate)
  372. .addClass(className.checked)
  373. ;
  374. if( module.is.radio() ) {
  375. module.uncheckOthers();
  376. }
  377. if(!module.is.indeterminate() && module.is.checked()) {
  378. module.debug('Input is already checked, skipping input property change');
  379. return;
  380. }
  381. module.verbose('Setting state to checked', input);
  382. $input
  383. .prop('indeterminate', false)
  384. .prop('checked', true)
  385. ;
  386. module.trigger.change();
  387. },
  388. unchecked: function() {
  389. module.verbose('Removing checked class');
  390. $module
  391. .removeClass(className.indeterminate)
  392. .removeClass(className.checked)
  393. ;
  394. if(!module.is.indeterminate() && module.is.unchecked() ) {
  395. module.debug('Input is already unchecked');
  396. return;
  397. }
  398. module.debug('Setting state to unchecked');
  399. $input
  400. .prop('indeterminate', false)
  401. .prop('checked', false)
  402. ;
  403. module.trigger.change();
  404. },
  405. indeterminate: function() {
  406. module.verbose('Setting class to indeterminate');
  407. $module
  408. .addClass(className.indeterminate)
  409. ;
  410. if( module.is.indeterminate() ) {
  411. module.debug('Input is already indeterminate, skipping input property change');
  412. return;
  413. }
  414. module.debug('Setting state to indeterminate');
  415. $input
  416. .prop('indeterminate', true)
  417. ;
  418. module.trigger.change();
  419. },
  420. determinate: function() {
  421. module.verbose('Removing indeterminate class');
  422. $module
  423. .removeClass(className.indeterminate)
  424. ;
  425. if( module.is.determinate() ) {
  426. module.debug('Input is already determinate, skipping input property change');
  427. return;
  428. }
  429. module.debug('Setting state to determinate');
  430. $input
  431. .prop('indeterminate', false)
  432. ;
  433. },
  434. disabled: function() {
  435. module.verbose('Setting class to disabled');
  436. $module
  437. .addClass(className.disabled)
  438. ;
  439. if( module.is.disabled() ) {
  440. module.debug('Input is already disabled, skipping input property change');
  441. return;
  442. }
  443. module.debug('Setting state to disabled');
  444. $input
  445. .prop('disabled', 'disabled')
  446. ;
  447. module.trigger.change();
  448. },
  449. enabled: function() {
  450. module.verbose('Removing disabled class');
  451. $module.removeClass(className.disabled);
  452. if( module.is.enabled() ) {
  453. module.debug('Input is already enabled, skipping input property change');
  454. return;
  455. }
  456. module.debug('Setting state to enabled');
  457. $input
  458. .prop('disabled', false)
  459. ;
  460. module.trigger.change();
  461. },
  462. tabbable: function() {
  463. module.verbose('Adding tabindex to checkbox');
  464. if( $input.attr('tabindex') === undefined) {
  465. $input.attr('tabindex', 0);
  466. }
  467. }
  468. },
  469. remove: {
  470. initialLoad: function() {
  471. initialLoad = false;
  472. }
  473. },
  474. trigger: {
  475. change: function() {
  476. var
  477. events = document.createEvent('HTMLEvents'),
  478. inputElement = $input[0]
  479. ;
  480. if(inputElement) {
  481. module.verbose('Triggering native change event');
  482. events.initEvent('change', true, false);
  483. inputElement.dispatchEvent(events);
  484. }
  485. }
  486. },
  487. create: {
  488. label: function() {
  489. if($input.prevAll(selector.label).length > 0) {
  490. $input.prev(selector.label).detach().insertAfter($input);
  491. module.debug('Moving existing label', $label);
  492. }
  493. else if( !module.has.label() ) {
  494. $label = $('<label>').insertAfter($input);
  495. module.debug('Creating label', $label);
  496. }
  497. }
  498. },
  499. has: {
  500. label: function() {
  501. return ($label.length > 0);
  502. }
  503. },
  504. bind: {
  505. events: function() {
  506. module.verbose('Attaching checkbox events');
  507. $module
  508. .on('click' + eventNamespace, module.event.click)
  509. .on('keydown' + eventNamespace, selector.input, module.event.keydown)
  510. .on('keyup' + eventNamespace, selector.input, module.event.keyup)
  511. ;
  512. }
  513. },
  514. unbind: {
  515. events: function() {
  516. module.debug('Removing events');
  517. $module
  518. .off(eventNamespace)
  519. ;
  520. }
  521. },
  522. uncheckOthers: function() {
  523. var
  524. $radios = module.get.otherRadios()
  525. ;
  526. module.debug('Unchecking other radios', $radios);
  527. $radios.removeClass(className.checked);
  528. },
  529. toggle: function() {
  530. if( !module.can.change() ) {
  531. if(!module.is.radio()) {
  532. module.debug('Checkbox is read-only or disabled, ignoring toggle');
  533. }
  534. return;
  535. }
  536. if( module.is.indeterminate() || module.is.unchecked() ) {
  537. module.debug('Currently unchecked');
  538. module.check();
  539. }
  540. else if( module.is.checked() && module.can.uncheck() ) {
  541. module.debug('Currently checked');
  542. module.uncheck();
  543. }
  544. },
  545. setting: function(name, value) {
  546. module.debug('Changing setting', name, value);
  547. if( $.isPlainObject(name) ) {
  548. $.extend(true, settings, name);
  549. }
  550. else if(value !== undefined) {
  551. if($.isPlainObject(settings[name])) {
  552. $.extend(true, settings[name], value);
  553. }
  554. else {
  555. settings[name] = value;
  556. }
  557. }
  558. else {
  559. return settings[name];
  560. }
  561. },
  562. internal: function(name, value) {
  563. if( $.isPlainObject(name) ) {
  564. $.extend(true, module, name);
  565. }
  566. else if(value !== undefined) {
  567. module[name] = value;
  568. }
  569. else {
  570. return module[name];
  571. }
  572. },
  573. debug: function() {
  574. if(!settings.silent && settings.debug) {
  575. if(settings.performance) {
  576. module.performance.log(arguments);
  577. }
  578. else {
  579. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  580. module.debug.apply(console, arguments);
  581. }
  582. }
  583. },
  584. verbose: function() {
  585. if(!settings.silent && settings.verbose && settings.debug) {
  586. if(settings.performance) {
  587. module.performance.log(arguments);
  588. }
  589. else {
  590. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  591. module.verbose.apply(console, arguments);
  592. }
  593. }
  594. },
  595. error: function() {
  596. if(!settings.silent) {
  597. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  598. module.error.apply(console, arguments);
  599. }
  600. },
  601. performance: {
  602. log: function(message) {
  603. var
  604. currentTime,
  605. executionTime,
  606. previousTime
  607. ;
  608. if(settings.performance) {
  609. currentTime = new Date().getTime();
  610. previousTime = time || currentTime;
  611. executionTime = currentTime - previousTime;
  612. time = currentTime;
  613. performance.push({
  614. 'Name' : message[0],
  615. 'Arguments' : [].slice.call(message, 1) || '',
  616. 'Element' : element,
  617. 'Execution Time' : executionTime
  618. });
  619. }
  620. clearTimeout(module.performance.timer);
  621. module.performance.timer = setTimeout(module.performance.display, 500);
  622. },
  623. display: function() {
  624. var
  625. title = settings.name + ':',
  626. totalTime = 0
  627. ;
  628. time = false;
  629. clearTimeout(module.performance.timer);
  630. $.each(performance, function(index, data) {
  631. totalTime += data['Execution Time'];
  632. });
  633. title += ' ' + totalTime + 'ms';
  634. if(moduleSelector) {
  635. title += ' \'' + moduleSelector + '\'';
  636. }
  637. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  638. console.groupCollapsed(title);
  639. if(console.table) {
  640. console.table(performance);
  641. }
  642. else {
  643. $.each(performance, function(index, data) {
  644. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  645. });
  646. }
  647. console.groupEnd();
  648. }
  649. performance = [];
  650. }
  651. },
  652. invoke: function(query, passedArguments, context) {
  653. var
  654. object = instance,
  655. maxDepth,
  656. found,
  657. response
  658. ;
  659. passedArguments = passedArguments || queryArguments;
  660. context = element || context;
  661. if(typeof query == 'string' && object !== undefined) {
  662. query = query.split(/[\. ]/);
  663. maxDepth = query.length - 1;
  664. $.each(query, function(depth, value) {
  665. var camelCaseValue = (depth != maxDepth)
  666. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  667. : query
  668. ;
  669. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  670. object = object[camelCaseValue];
  671. }
  672. else if( object[camelCaseValue] !== undefined ) {
  673. found = object[camelCaseValue];
  674. return false;
  675. }
  676. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  677. object = object[value];
  678. }
  679. else if( object[value] !== undefined ) {
  680. found = object[value];
  681. return false;
  682. }
  683. else {
  684. module.error(error.method, query);
  685. return false;
  686. }
  687. });
  688. }
  689. if ( $.isFunction( found ) ) {
  690. response = found.apply(context, passedArguments);
  691. }
  692. else if(found !== undefined) {
  693. response = found;
  694. }
  695. if($.isArray(returnedValue)) {
  696. returnedValue.push(response);
  697. }
  698. else if(returnedValue !== undefined) {
  699. returnedValue = [returnedValue, response];
  700. }
  701. else if(response !== undefined) {
  702. returnedValue = response;
  703. }
  704. return found;
  705. }
  706. };
  707. if(methodInvoked) {
  708. if(instance === undefined) {
  709. module.initialize();
  710. }
  711. module.invoke(query);
  712. }
  713. else {
  714. if(instance !== undefined) {
  715. instance.invoke('destroy');
  716. }
  717. module.initialize();
  718. }
  719. })
  720. ;
  721. return (returnedValue !== undefined)
  722. ? returnedValue
  723. : this
  724. ;
  725. };
  726. $.fn.checkbox.settings = {
  727. name : 'Checkbox',
  728. namespace : 'checkbox',
  729. silent : false,
  730. debug : false,
  731. verbose : true,
  732. performance : true,
  733. // delegated event context
  734. uncheckable : 'auto',
  735. fireOnInit : false,
  736. onChange : function(){},
  737. beforeChecked : function(){},
  738. beforeUnchecked : function(){},
  739. beforeDeterminate : function(){},
  740. beforeIndeterminate : function(){},
  741. onChecked : function(){},
  742. onUnchecked : function(){},
  743. onDeterminate : function() {},
  744. onIndeterminate : function() {},
  745. onEnable : function(){},
  746. onDisable : function(){},
  747. // preserve misspelled callbacks (will be removed in 3.0)
  748. onEnabled : function(){},
  749. onDisabled : function(){},
  750. className : {
  751. checked : 'checked',
  752. indeterminate : 'indeterminate',
  753. disabled : 'disabled',
  754. hidden : 'hidden',
  755. radio : 'radio',
  756. readOnly : 'read-only'
  757. },
  758. error : {
  759. method : 'The method you called is not defined'
  760. },
  761. selector : {
  762. checkbox : '.ui.checkbox',
  763. label : 'label, .box',
  764. input : 'input[type="checkbox"], input[type="radio"]',
  765. link : 'a[href]'
  766. }
  767. };
  768. })( jQuery, window, document );