PageRenderTime 73ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/themes/default-bootstrap/js/debug/jquery.lint.js

https://gitlab.com/staging06/myproject
JavaScript | 549 lines | 486 code | 37 blank | 26 comment | 14 complexity | b4e62d478fc99a22ba4e1c7b3361a7d1 MD5 | raw file
  1. /**
  2. * jQuery Lint
  3. * ---
  4. * VERSION 1.1
  5. * ---
  6. * jQuery lint creates a thin blanket over jQuery that'll
  7. * report any potentially erroneous activity to the console.
  8. * ---
  9. * Idea from:
  10. * http://markmail.org/message/wzkosk2s5jklpkv4
  11. * http://groups.google.com/group/jquery-dev/browse_thread/thread/9a15cca62ceb2444
  12. * ---
  13. * @author James Padolsey
  14. * @contributors Paul Irish, Zoran Zaric, Hans-Peter Buniat
  15. * ---
  16. * Dual licensed under the MIT and GPL licenses.
  17. * - http://www.opensource.org/licenses/mit-license.php
  18. * - http://www.gnu.org/copyleft/gpl.html
  19. */
  20. (function(){
  21. var _jQuery = window.jQuery; // Change as needed
  22. if (!_jQuery) {
  23. return;
  24. }
  25. var glob = window,
  26. langs = {
  27. en: {
  28. incorrectCall: '%0(%1) called incorrectly',
  29. specialCheckFailed: '%0(%1) special check failed',
  30. moreInfo: 'More info:',
  31. youPassed: 'You passed: ',
  32. collection: 'Collection:',
  33. availableSigsInclude: 'Available signatures include: ',
  34. errorThrown: 'When I called %0(%1) with your args, an error was thrown!',
  35. repeatSelector: "You've used the same selector more than once.",
  36. info: 'Info',
  37. selector: 'Selector: ',
  38. slowSelector: 'Selector: %0\nSelectors should be as specific as possible, not overqualified and never "class only"',
  39. selectorAdvice: "You should only use the same selector more than once when you know the returned collection will be different. For example, if you've added more elements to the page that may comply with the selector",
  40. noElementsFound: 'No elements were found with the selector: "%0"',
  41. combineCalls: 'Why not combine these calls by passing an object? E.g. \n%0(%1)',
  42. methodTwice: "You've called %0(%1) more than once on the same jQuery object",
  43. triggeredBy: 'Triggered by %0 event',
  44. notBestMethod: 'Insted of accessing the property via %0(%1), use %2 insted',
  45. event: 'Event:',
  46. handler: 'Handler:',
  47. location: 'Location:',
  48. invalidFilters: 'Selector: %0\nYou used invalid filters (aka Pseudo classes):\n%1',
  49. badReadyCall: "Don't use jQuery().ready() - use jQuery(document).ready() instead. The former is likely to be deprecated in the future.",
  50. browser: "Don't use jQuery.browser",
  51. browserSafari: "Don't use jQuery.browser.safari - it's deprecated. If you have to use browser detection, then use jQuery.browser.webkit.",
  52. featureDetection: 'The jQuery team recommends against using jQuery.browser, please try to use feature detection instead (see jQuery.support).',
  53. boxModel: "Don't use jQuery.boxModel.",
  54. boxModelDeprecated: 'Deprecated in jQuery 1.3 (see jQuery.support)'
  55. },
  56. de: {
  57. incorrectCall: '%0(%1) falsch aufgerufen',
  58. specialCheckFailed: '%0(%1) Spezial-Check fehlgeschlagen',
  59. moreInfo: 'Mehr Informationen:',
  60. youPassed: 'Du hast übergeben: ',
  61. collection: 'Sammlung:',
  62. availableSigsInclude: 'Verfügbare Signaturen enthalten: ',
  63. errorThrown: 'Als ich %0(%1) mit deinen Argumenten aufgerufen habe, wurde ein Fehler geworfen!',
  64. repeatSelector: "Du hast den selben Selektor mehrmals verwendet.",
  65. info: 'Info',
  66. selector: 'Selektor: ',
  67. slowSelector: 'Selektor: %0\nSelektoren sollten so spezifisch wie moeglich sein, nicht ueberqualifiziert und nicht nur anhand einer Klasse selektieren',
  68. selectorAdvice: "Du solltest den selben Selektor nur dann verwenden, wenn du weißt dass sich das Ergebnis ändert. Zum Beispiel, wenn du Elemente zu einer Seite hinzufügst, die den Selektor erfüllen",
  69. noElementsFound: 'Keine Elemente gefunden für den Selektor: "%0"',
  70. combineCalls: 'Warum kombinierst du diese Aufrufen nicht, indem du ein Objekt übergibst? z.B. \n%0(%1)',
  71. methodTwice: "Du hast %0(%1) mehr als ein mal auf dem selben jQuery-Objekt aufgerufen",
  72. triggeredBy: 'Vom %0-Event getriggert',
  73. notBestMethod: 'Verwende %2 anstelle von %0(%1)',
  74. event: 'Event:',
  75. handler: 'Handler:',
  76. location: 'Location:',
  77. invalidFilters: 'Selektor: %0\nDu hast fehlerhafte Filter verwendet (aka Pseudo Klassen):\n%1',
  78. badReadyCall: "Verwende jQuery().ready() nicht - verwende stattdessen jQuery(document).ready(). Ersteres wird wahrscheinlich in der Zukunft deprecated.",
  79. browser: "Verwende jQuery.browser nicht",
  80. browserSafari: "Verwende jQuery.browser.safari nicht - es ist deprecated. Wenn du eine Browser-Erkennung verwenden musst, nimm jQuery.browser.webkit.",
  81. featureDetection: 'Das jQuery-Team empfiehlt jQuery.browser nicht zu verwenden. Verwende lieber Feature-Erkennung (siehe jQuery.support).',
  82. boxModel: "Verwende jQuery.boxModel nicht.",
  83. boxModelDeprecated: 'Deprecated in jQuery 1.3 (siehe jQuery.support)'
  84. }
  85. },
  86. // Define console if not defined
  87. // Access it via jQuery.LINT.console
  88. emptyFn = function(){},
  89. _console = {
  90. warn: glob.console && console.warn ?
  91. function(){
  92. console.warn.apply(console, arguments);
  93. } : emptyFn,
  94. group: glob.console && console.group ?
  95. function(){
  96. console.group.apply(console, arguments);
  97. } : emptyFn,
  98. groupEnd: glob.console && console.groupEnd ?
  99. function(){
  100. console.groupEnd();
  101. } : emptyFn,
  102. groupCollapsed: glob.console && console.groupCollapsed ?
  103. function(){
  104. console.groupCollapsed.apply(console, arguments);
  105. } : emptyFn,
  106. log: glob.console && console.log ?
  107. function(){
  108. console.log.apply(console, arguments);
  109. } : emptyFn
  110. },
  111. // Add specific checks
  112. // This is the best place to bring up bad practices
  113. checks = [
  114. {/* Level 0 */},
  115. {/* Level 1 */},
  116. {/* Level 2 */},
  117. {/* Level 3 */}
  118. ],
  119. addCheck = function(methodName, level, check) {
  120. level = Math.min(3, ~~level);
  121. (checks[level][methodName] || (checks[level][methodName] = [])).push(check);
  122. return lint;
  123. },
  124. lint = {
  125. version: '1.01',
  126. level: 3,
  127. checks: checks,
  128. special: checks, // Support decrecated API
  129. addCheck: addCheck,
  130. lang: 'en',
  131. langs: langs,
  132. console: _console,
  133. throwErrors: false,
  134. enabledReports: {
  135. // True to report, false to supress
  136. noElementsFound: true,
  137. repeatSelector: true,
  138. browserSniffing: true,
  139. slowSelector: true,
  140. invalidFilters: true
  141. },
  142. api: {focus:[{added:"1.0"},{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]},{added:"1.6"}],"deferred.pipe":[{added:"1.6",arg:[{name:"doneFilter",type:"Function",optional:true},{name:"failFilter",type:"Function",optional:true}]}],"deferred.always":[{added:"1.6",arg:[{name:"alwaysCallbacks",type:"Function"}]}],promise:[{added:"1.6",arg:[{name:"type",type:"String",optional:true,"default":"fx"},{name:"target",type:"Object, Function",optional:true,multiple:true}]}],removeProp:[{added:"1.6",arg:[{name:"propertyName",type:"String"},{name:"value",type:"String, Number, Boolean"}]}],prop:[{added:"1.6",arg:[{name:"propertyName",type:"String"},{name:"function(index, oldPropertyValue)",type:"Function"}]},{added:"1.6",arg:[{name:"map",type:"Map"}]},{added:"1.6",arg:[{name:"propertyName",type:"String"},{name:"value",type:"String, Number, Boolean"}]},{added:"1.6",arg:[{name:"propertyName",type:"String"}]}],"jQuery.ajaxPrefilter":[{added:"1.5",arg:[{name:"dataTypes",optional:true,type:"String"},{name:"handler(options, originalOptions, jqXHR)",type:"Function"}]}],"jQuery.holdReady":[{added:"1.6",arg:[{name:"hold",type:"Boolean"}]}],"jQuery.hasData":[{added:"1.5",arg:[{name:"element",type:"Element"}]}],"jQuery.now":[{added:"1.4.3"}],jquery:[{added:"1.0"}],"deferred.promise":[{added:"1.5",arg:[{name:"target",type:"Object, Function",optional:true,multiple:true}]}],"jQuery.cssHooks":[{added:"1.4.3"}],"jQuery.parseXML":[{added:"1.5",arg:[{name:"data",type:"String"}]}],"jQuery.when":[{added:"1.5",arg:[{name:"deferreds",type:"Deferred"}]}],"deferred.resolveWith":[{added:"1.5",arg:[{name:"context",type:"Object"},{name:"args",type:"Array",optional:true}]}],"deferred.rejectWith":[{added:"1.5",arg:[{name:"context",type:"Object"},{name:"args",type:"Array",optional:true}]}],"deferred.fail":[{added:"1.5",arg:[{name:"failCallbacks",type:"Function"},{name:"failCallbacks",type:"Function",optional:true,multiple:true}]}],"deferred.done":[{added:"1.5",arg:[{name:"doneCallbacks",type:"Function"},{name:"doneCallbacks",type:"Function",optional:true,multiple:true}]}],"deferred.then":[{added:"1.5",arg:[{name:"doneCallbacks",type:"Function"},{name:"failCallbacks",type:"Function"}]}],"deferred.reject":[{added:"1.5",arg:[{name:"args",type:"Object"}]}],"deferred.isRejected":[{added:"1.5"}],"deferred.isResolved":[{added:"1.5"}],"deferred.resolve":[{added:"1.5",arg:[{name:"args",type:"Object"}]}],"jQuery.sub":[{added:"1.5"}],fadeToggle:[{added:"1.4.4",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Function",optional:true}]}],"jQuery.type":[{added:"1.4.3",arg:[{name:"obj",type:"Object"}]}],"jQuery.isWindow":[{added:"1.4.3",arg:[{name:"obj",type:"Object"}]}],toggle:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"},{name:"handler(eventObject)",type:"Function",multiple:true},{name:"handler(eventObject)",optional:true,type:"Function",multiple:true}]},{added:"1.0",arg:[{name:"duration",type:"String,Number",optional:true},{name:"callback",type:"Callback",optional:true}]},{added:"1.3",arg:[{name:"showOrHide",type:"Boolean"}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],"jQuery.fx.interval":[{added:"1.4.3"}],"event.namespace":[{added:"1.4.3"}],undelegate:[{added:"1.4.3",arg:[{name:"selector",type:"String"},{name:"events",type:"Map"}]},{added:"1.4.2"},{added:"1.4.2",arg:[{name:"selector",type:"String"},{name:"eventType",type:"String"},{name:"handler",type:"Function"}]},{added:"1.4.2",arg:[{name:"selector",type:"String"},{name:"eventType",type:"String"}]},{added:"1.6",arg:[{name:"namespace",type:"String"}]}],delegate:[{added:"1.4.3",arg:[{name:"selector",type:"String"},{name:"events",type:"Map"}]},{added:"1.4.2",arg:[{name:"selector",type:"String"},{name:"eventType",type:"String"},{name:"eventData",type:"Object"},{name:"handler",type:"Function"}]},{added:"1.4.2",arg:[{name:"selector",type:"String"},{name:"eventType",type:"String"},{name:"handler",type:"Function"}]}],"jQuery.error":[{added:"1.4.1",arg:[{name:"message",type:"String"}]}],"jQuery.parseJSON":[{added:"1.4.1",arg:[{name:"json",type:"String"}]}],"jQuery.proxy":[{added:"1.4",arg:[{name:"context",type:"Object"},{name:"name",type:"String"}]},{added:"1.4",arg:[{name:"function",type:"Function"},{name:"context",type:"Object"}]}],focusout:[{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]},{added:"1.4",arg:[{name:"handler(eventObject)",type:"Function"}]}],focusin:[{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]},{added:"1.4",arg:[{name:"handler(eventObject)",type:"Function"}]}],has:[{added:"1.1.4",arg:[{name:"selector",type:"Selector"}]},{added:"1.4",arg:[{name:"contained",type:"Element"}]},{added:"1.4",arg:[{name:"selector",type:"String"}]}],"jQuery.contains":[{added:"1.4",arg:[{name:"container",type:"Element"},{name:"contained",type:"Element"}]}],"jQuery.noop":[{added:"1.4"}],delay:[{added:"1.4",arg:[{name:"duration",type:"Integer"},{name:"queueName",optional:true,type:"String"}]}],parentsUntil:[{added:"1.4",arg:[{name:"selector",optional:true,type:"Selector"}]}],prevUntil:[{added:"1.4",arg:[{name:"selector",optional:true,type:"Selector"}]}],nextUntil:[{added:"1.4",arg:[{name:"selector",optional:true,type:"Selector"}]}],"event.isImmediatePropagationStopped":[{added:"1.3"}],"event.stopImmediatePropagation":[{added:"1.3"}],"event.isPropagationStopped":[{added:"1.3"}],"event.stopPropagation":[{added:"1.0"}],"event.isDefaultPrevented":[{added:"1.3"}],"event.preventDefault":[{added:"1.0"}],"event.timeStamp":[{added:"1.2.6"}],"event.result":[{added:"1.3"}],"event.which":[{added:"1.1.3"}],"event.pageY":[{added:"1.0.4"}],"event.pageX":[{added:"1.0.4"}],"event.currentTarget":[{added:"1.3"}],"event.relatedTarget":[{added:"1.1.4"}],"event.data":[{added:"1.1"}],"event.target":[{added:"1.0"}],"event.type":[{added:"1.0"}],"jQuery.fx.off":[{added:"1.3"}],each:[{added:"1.0",arg:[{name:"function(index, Element)",type:"Function"}]}],pushStack:[{added:"1.0",arg:[{name:"elements",type:"Array"}]},{added:"1.3",arg:[{name:"elements",type:"Array"},{name:"name",type:"String"},{name:"arguments",type:"Array"}]}],"jQuery.globalEval":[{added:"1.0.4",arg:[{name:"code",type:"String"}]}],"jQuery.isXMLDoc":[{added:"1.1.4",arg:[{name:"node",type:"Element"}]}],"jQuery.removeData":[{added:"1.2.3",arg:[{name:"element",type:"Element"},{name:"name",type:"String",optional:true}]}],"jQuery.data":[{added:"1.2.3",arg:[{name:"element",type:"Element"},{name:"key",type:"String"},{name:"value",type:"*",multiple:true}]},{added:"1.2.3",arg:[{name:"element",type:"Element"},{name:"key",type:"String"}]},{added:"1.4",arg:[{name:"element",type:"Element"}]}],"jQuery.dequeue":[{added:"1.3",arg:[{name:"element",type:"Element"},{name:"queueName",optional:true,type:"String"}]}],"jQuery.queue":[{added:"1.3",arg:[{name:"element",type:"Element"},{name:"queueName",type:"String"},{name:"callback()",type:"Function"}]},{added:"1.3",arg:[{name:"element",type:"Element"},{name:"queueName",type:"String"},{name:"newQueue",type:"Array"}]},{added:"1.3",arg:[{name:"element",type:"Element"},{name:"queueName",optional:true,type:"String"}]}],clearQueue:[{added:"1.4",arg:[{name:"queueName",optional:true,type:"String"}]}],toArray:[{added:"1.4"}],"jQuery.isEmptyObject":[{added:"1.4",arg:[{name:"object",type:"Object"}]}],"jQuery.isPlainObject":[{added:"1.4",arg:[{name:"object",type:"Object"}]}],keydown:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],index:[{added:"1.0",arg:[{name:"element",type:"Element, jQuery"}]},{added:"1.4",arg:[{name:"selector",type:"Selector"}]},{added:"1.4"}],removeData:[{added:"1.2.3",arg:[{name:"name",type:"String",optional:true}]}],data:[{added:"1.2.3",arg:[{name:"key",type:"String"}]},{added:"1.2.3",arg:[{name:"key",type:"String"},{name:"value",type:"*",multiple:true}]},{added:"1.4"},{added:"1.4.3",arg:[{name:"obj",type:"Object"}]}],get:[{added:"1.0",arg:[{name:"index",type:"Number",optional:true}]}],size:[{added:"1.0"}],"jQuery.noConflict":[{added:"1.0",arg:[{name:"removeAll",type:"Boolean",optional:true}]}],selected:[{added:"1.0"}],checked:[{added:"1.0"}],disabled:[{added:"1.0"}],enabled:[{added:"1.0"}],file:[{added:"1.0"}],button:[{added:"1.0"}],reset:[{added:"1.0"}],image:[{added:"1.0"}],submit:[{added:"1.0"},{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],checkbox:[{added:"1.0"}],radio:[{added:"1.0"}],password:[{added:"1.0"}],text:[{added:"1.0",arg:[{name:"textString",type:"String, Number"}]},{added:"1.0"},{added:"1.0"},{added:"1.4",arg:[{name:"function(index, text)",type:"Function"}]}],input:[{added:"1.0"}],"only-child":[{added:"1.1.4"}],"last-child":[{added:"1.1.4"}],"first-child":[{added:"1.1.4"}],"nth-child":[{added:"1.1.4",arg:[{name:"index",type:"Number\/String"}]}],attributeContainsPrefix:[{added:"1.0",arg:[{name:"attribute",type:"String"},{name:"value",type:"String"}]}],attributeContainsWord:[{added:"1.0",arg:[{name:"attribute",type:"String"},{name:"value",type:"String"}]}],attributeMultiple:[{added:"1.0",arg:[{name:"attributeFilter1",type:"Selector"},{name:"attributeFilter2",type:"Selector"},{name:"attributeFilterN",optional:true,type:"Selector"}]}],attributeContains:[{added:"1.0",arg:[{name:"attribute",type:"String"},{name:"value",type:"String"}]}],attributeEndsWith:[{added:"1.0",arg:[{name:"attribute",type:"String"},{name:"value",type:"String"}]}],attributeStartsWith:[{added:"1.0",arg:[{name:"attribute",type:"String"},{name:"value",type:"String"}]}],attributeNotEqual:[{added:"1.0",arg:[{name:"attribute",type:"String"},{name:"value",type:"String"}]}],attributeEquals:[{added:"1.0",arg:[{name:"attribute",type:"String"},{name:"value",type:"String"}]}],attributeHas:[{added:"1.0",arg:[{name:"attribute",type:"String"}]}],visible:[{added:"1.0"}],hidden:[{added:"1.0"}],parent:[{added:"1.0",arg:[{name:"selector",optional:true,type:"Selector"}]},{added:"1.0"}],empty:[{added:"1.0"},{added:"1.0"}],contains:[{added:"1.1.4",arg:[{name:"text",type:"String"}]}],animated:[{added:"1.2"}],header:[{added:"1.2"}],lt:[{added:"1.0",arg:[{name:"index",type:"Number"}]}],gt:[{added:"1.0",arg:[{name:"index",type:"Number"}]}],eq:[{added:"1.0",arg:[{name:"index",type:"Number"}]},{added:"1.1.2",arg:[{name:"index",type:"Integer"}]},{added:"1.4",arg:[{name:"-index",type:"Integer"}]}],odd:[{added:"1.0"}],even:[{added:"1.0"}],not:[{added:"1.0",arg:[{name:"elements",type:"Elements"}]},{added:"1.0",arg:[{name:"selector",type:"Selector"}]},{added:"1.0",arg:[{name:"selector",type:"Selector"}]},{added:"1.4",arg:[{name:"function(index)",type:"Function"}]}],last:[{added:"1.0"},{added:"1.4"}],first:[{added:"1.0"},{added:"1.4"}],"next siblings":[{added:"1.0",arg:[{name:"prev",type:"Selector"},{name:"siblings",type:"Selector"}]}],"next adjacent":[{added:"1.0",arg:[{name:"prev",type:"Selector"},{name:"next",type:"Selector"}]}],child:[{added:"1.0",arg:[{name:"parent",type:"Selector"},{name:"child",type:"Selector"}]}],descendant:[{added:"1.0",arg:[{name:"ancestor",type:"Selector"},{name:"descendant",type:"Selector"}]}],multiple:[{added:"1.0",arg:[{name:"selector1",type:"Selector"},{name:"selector2",type:"Selector"},{name:"selectorN",optional:true,type:"Selector"}]}],all:[{added:"1.0"}],"class":[{added:"1.0",arg:[{name:"class",type:"String"}]}],element:[{added:"1.0",arg:[{name:"element",type:"String"}]}],id:[{added:"1.0",arg:[{name:"id",type:"String"}]}],scroll:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],resize:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],dequeue:[{added:"1.2",arg:[{name:"queueName",optional:true,type:"String"}]}],queue:[{added:"1.2",arg:[{name:"queueName",optional:true,type:"String"},{name:"callback( next )",type:"Function"}]},{added:"1.2",arg:[{name:"queueName",optional:true,type:"String"},{name:"newQueue",type:"Array"}]},{added:"1.2",arg:[{name:"queueName",optional:true,type:"String"}]}],keyup:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],keypress:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],select:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],change:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],blur:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],mousemove:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],hover:[{added:"1.0",arg:[{name:"handlerIn(eventObject)",type:"Function"},{name:"handlerOut(eventObject)",type:"Function"}]},{added:"1.4",arg:[{name:"handlerInOut(eventObject)",type:"Function"}]}],mouseleave:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],mouseenter:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],mouseout:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],mouseover:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],dblclick:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],click:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],mouseup:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],mousedown:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0"},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],error:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],unload:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],load:[{added:"1.0",arg:[{name:"handler(eventObject)",type:"Function"}]},{added:"1.0",arg:[{name:"url",type:"String"},{name:"data",optional:"true ",type:"Map, String"},{name:"complete(responseText, textStatus, XMLHttpRequest)",type:"Function",optional:true}]},{added:"1.4.3",arg:[{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],ready:[{added:"1.0",arg:[{name:"handler",type:"Function"}]}],die:[{added:"1.3",arg:[{name:"eventType",type:"String"},{name:"handler",optional:true,type:"String"}]},{added:"1.4.3",arg:[{name:"eventTypes",type:"Map"}]},{added:"1.4.1"}],"jQuery.browser":[{added:"1.0"}],"jQuery.browser.version":[{added:"1.1.3"}],live:[{added:"1.3",arg:[{name:"eventType",type:"String"},{name:"handler",type:"Function"}]},{added:"1.4.3",arg:[{name:"events",type:"Object"}]},{added:"1.4",arg:[{name:"eventType",type:"String"},{name:"eventData",type:"Object"},{name:"handler",type:"Function"}]}],triggerHandler:[{added:"1.2",arg:[{name:"eventType",type:"String"},{name:"extraParameters",type:"Array"}]}],trigger:[{added:"1.0",arg:[{name:"eventType",type:"String"},{name:"extraParameters",type:"Object"}]},{added:"1.3",arg:[{name:"event",type:"Event"}]}],ajaxComplete:[{added:"1.0",arg:[{name:"handler(event, XMLHttpRequest, ajaxOptions)",type:"Function"}]}],one:[{added:"1.1",arg:[{name:"eventType",type:"String"},{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]}],serializeArray:[{added:"1.2"}],serialize:[{added:"1.0"}],"jQuery.ajaxSetup":[{added:"1.1",arg:[{name:"options",type:"Options"}]}],ajaxSuccess:[{added:"1.0",arg:[{name:"handler(event, XMLHttpRequest, ajaxOptions)",type:"Function"}]}],ajaxStop:[{added:"1.0",arg:[{name:"handler()",type:"Function"}]}],ajaxStart:[{added:"1.0",arg:[{name:"handler()",type:"Function"}]}],ajaxSend:[{added:"1.0",arg:[{name:"handler(event, jqXHR, ajaxOptions)",type:"Function"}]}],ajaxError:[{added:"1.0",arg:[{name:"handler(event, jqXHR, ajaxSettings, thrownError)",type:"Function"}]}],unbind:[{added:"1.0",arg:[{name:"eventType",type:"String",optional:true},{name:"handler(eventObject)",type:"Function",optional:true}]},{added:"1.0",arg:[{name:"event",type:"Object"}]},{added:"1.4.3",arg:[{name:"eventType",type:"String"},{name:"false",type:"Boolean"}]}],bind:[{added:"1.0",arg:[{name:"eventType",type:"String"},{name:"eventData",type:"Object",optional:true},{name:"handler(eventObject)",type:"Function"}]},{added:"1.4",arg:[{name:"events",type:"Object"}]},{added:"1.4.3",arg:[{name:"eventType",type:"String"},{name:"eventData",type:"Object",optional:true},{name:"false",type:"Boolean"}]}],slice:[{added:"1.1.4",arg:[{name:"start",type:"Integer"},{name:"end",optional:true,type:"Integer"}]}],jQuery:[{added:"1.0",arg:[{name:"html",type:"String"},{name:"ownerDocument",optional:true,type:"document"}]},{added:"1.0",arg:[{name:"callback",type:"Function"}]},{added:"1.0",arg:[{name:"selector",type:"selector"},{name:"context",optional:true,type:"Element, jQuery"}]},{added:"1.0",arg:[{name:"jQuery object",type:"Object"}]},{added:"1.0",arg:[{name:"element",type:"Element"}]},{added:"1.0",arg:[{name:"elementArray",type:"Array"}]},{added:"1.4"},{added:"1.4",arg:[{name:"html",type:"String"},{name:"props",type:"Object"}]}],stop:[{added:"1.2",arg:[{name:"clearQueue",type:"Boolean",optional:true},{name:"jumpToEnd",type:"Boolean",optional:true}]}],end:[{added:"1.0"}],andSelf:[{added:"1.2"}],siblings:[{added:"1.0",arg:[{name:"selector",optional:true,type:"Selector"}]}],animate:[{added:"1.0",arg:[{name:"properties",type:"Map"},{name:"options",type:"Map"}]},{added:"1.0",arg:[{name:"properties",type:"Map"},{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"complete",type:"Function",optional:true}]}],prevAll:[{added:"1.2",arg:[{name:"selector",optional:true,type:"Selector"}]}],prev:[{added:"1.0",arg:[{name:"selector",optional:true,type:"Selector"}]}],fadeTo:[{added:"1.0",arg:[{name:"duration",type:"String,Number"},{name:"opacity",type:"Number"},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number"},{name:"opacity",type:"Number"},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],fadeOut:[{added:"1.0",arg:[{name:"duration",type:"String,Number",optional:true},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],parents:[{added:"1.0",arg:[{name:"selector",optional:true,type:"Selector"}]}],fadeIn:[{added:"1.0",arg:[{name:"duration",type:"String,Number",optional:true},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],offsetParent:[{added:"1.2.6"}],slideToggle:[{added:"1.0",arg:[{name:"duration",type:"String,Number",optional:true},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],"jQuery.post":[{added:"1.0",arg:[{name:"url",type:"String"},{name:"data",optional:true,type:"Map, String"},{name:"success(data, textStatus, jqXHR)",optional:true,type:"Function"},{name:"dataType",optional:true,type:"String"}]}],slideUp:[{added:"1.0",arg:[{name:"duration",type:"String,Number",optional:true},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],nextAll:[{added:"1.2",arg:[{name:"selector",optional:true,type:"String"}]}],next:[{added:"1.0",arg:[{name:"selector",optional:true,type:"Selector"}]}],slideDown:[{added:"1.0",arg:[{name:"duration",type:"String,Number",optional:true},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],find:[{added:"1.0",arg:[{name:"selector",type:"Selector"}]},{added:"1.6",arg:[{name:"element",type:"Element"}]},{added:"1.6",arg:[{name:"jQuery object",type:"Object"}]}],"jQuery.getScript":[{added:"1.0",arg:[{name:"url",type:"String"},{name:"success(data, textStatus)",optional:true,type:"Function"}]}],contents:[{added:"1.2"}],closest:[{added:"1.3",arg:[{name:"selector",type:"Selector"}]},{added:"1.4",arg:[{name:"selector",type:"Selector"},{name:"context",optional:true,type:"Element"}]},{added:"1.4",arg:[{name:"selectors",type:"Array"},{name:"context",optional:true,type:"Element"}]},{added:"1.6",arg:[{name:"jQuery object",type:"jQuery"}]},{added:"1.6",arg:[{name:"element",type:"Element"}]}],"jQuery.getJSON":[{added:"1.0",arg:[{name:"url",type:"String"},{name:"data",optional:true,type:"Map"},{name:"success(data, textStatus, jqXHR)",optional:true,type:"Function"}]}],"jQuery.get":[{added:"1.0",arg:[{name:"url",type:"String"},{name:"data",optional:true,type:"Map, String"},{name:"success(data, textStatus, jqXHR)",optional:true,type:"Function"},{name:"dataType",optional:true,type:"String"}]}],"jQuery.ajax":[{added:"1.0",arg:[{name:"settings",type:"Map"}]},{added:"1.5",arg:[{name:"url",type:"String"},{name:"settings",type:"Map",optional:true}]}],length:[{added:"1.0"}],children:[{added:"1.0",arg:[{name:"selector",optional:true,type:"Selector"}]}],selector:[{added:"1.3"}],add:[{added:"1.0",arg:[{name:"html",type:"HTML"}]},{added:"1.0",arg:[{name:"elements",type:"Elements"}]},{added:"1.0",arg:[{name:"selector",type:"Selector"}]},{added:"1.4",arg:[{name:"selector",type:"Selector"},{name:"context",type:"Element"}]}],context:[{added:"1.3"}],outerWidth:[{added:"1.2.6",arg:[{name:"includeMargin",optional:true,type:"Boolean"}]}],outerHeight:[{added:"1.2.6",arg:[{name:"includeMargin",optional:true,type:"Boolean"}]}],innerWidth:[{added:"1.2.6"}],innerHeight:[{added:"1.2.6"}],"jQuery.param":[{added:"1.2",arg:[{name:"obj",type:"Array, Object"}]},{added:"1.4",arg:[{name:"obj",type:"Array, Object"},{name:"traditional",type:"Boolean"}]}],hide:[{added:"1.0"},{added:"1.0",arg:[{name:"duration",type:"String,Number"},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],width:[{added:"1.0"},{added:"1.0",arg:[{name:"value",type:"String, Number"}]},{added:"1.4.1",arg:[{name:"function(index, width)",type:"Function"}]}],height:[{added:"1.0"},{added:"1.0",arg:[{name:"value",type:"String, Number"}]},{added:"1.4.1",arg:[{name:"function(index, height)",type:"Function"}]}],show:[{added:"1.0"},{added:"1.0",arg:[{name:"duration",type:"String,Number"},{name:"callback",type:"Callback",optional:true}]},{added:"1.4.3",arg:[{name:"duration",type:"String,Number",optional:true},{name:"easing",type:"String",optional:true},{name:"callback",type:"Callback",optional:true}]}],scrollLeft:[{added:"1.2.6",arg:[{name:"value",type:"Number"}]},{added:"1.2.6"}],"jQuery.trim":[{added:"1.0",arg:[{name:"str",type:"String"}]}],"jQuery.isFunction":[{added:"1.2",arg:[{name:"obj",type:"Object"}]}],"jQuery.isArray":[{added:"1.3",arg:[{name:"obj",type:"Object"}]}],"jQuery.unique":[{added:"1.1.3",arg:[{name:"array",type:"Array"}]}],"jQuery.merge":[{added:"1.0",arg:[{name:"first",type:"Array"},{name:"second",type:"Array"}]}],"jQuery.inArray":[{added:"1.2",arg:[{name:"value",type:"Any"},{name:"array",type:"Array"}]}],"jQuery.map":[{added:"1.0",arg:[{name:"array",type:"Array"},{name:"callback(elementOfArray, indexInArray)",type:"Function"}]},{added:"1.6",arg:[{name:"arrayOrObject",type:"Array,Object"},{name:"callback( value, indexOrKey )",type:"Function"}]}],"jQuery.makeArray":[{added:"1.2",arg:[{name:"obj",type:"Object"}]}],"jQuery.grep":[{added:"1.0",arg:[{name:"array",type:"Array"},{name:"function(elementOfArray, indexInArray)",type:"Function"},{name:"invert",optional:true,type:"Boolean"}]}],"jQuery.extend":[{added:"1.0",arg:[{name:"target",type:"Object, Function",multiple:true},{name:"object1",type:"Object",optional:true},{name:"objectN",optional:true,type:"Object"}]},{added:"1.1.4",arg:[{name:"deep",optional:true,type:"Boolean"},{name:"target",type:"Object, Function",multiple:true},{name:"object1",type:"Object"},{name:"objectN",optional:true,type:"Object"}]}],"jQuery.each":[{added:"1.0",arg:[{name:"collection",type:"Object, Array"},{name:"callback(indexInArray, valueOfElement)",type:"Function"}]}],"jQuery.boxModel":[{added:"1.0"}],scrollTop:[{added:"1.2.6",arg:[{name:"value",type:"Number"}]},{added:"1.2.6"}],"jQuery.support":[{added:"1.3"}],position:[{added:"1.2"}],offset:[{added:"1.2"},{added:"1.4",arg:[{name:"function(index, coords)",type:"Function"}]},{added:"1.4",arg:[{name:"coordinates",type:"Object"}]}],css:[{added:"1.0",arg:[{name:"map",type:"Map"}]},{added:"1.0",arg:[{name:"propertyName",type:"String"},{name:"value",type:"String, Number"}]},{added:"1.0",arg:[{name:"propertyName",type:"String"}]},{added:"1.4",arg:[{name:"propertyName",type:"String"},{name:"function(index, value)",type:"Function"}]}],unwrap:[{added:"1.4"}],detach:[{added:"1.4",arg:[{name:"selector",optional:true,type:"Selector"}]}],clone:[{added:"1.0",arg:[{name:"withDataAndEvents",optional:true,type:"Boolean","default":"false"}]},{added:"1.5",arg:[{name:"withDataAndEvents",optional:true,type:"Boolean","default":"false"},{name:"deepWithDataAndEvents",optional:true,type:"Boolean","default":"value of withDataAndEvents"}]}],remove:[{added:"1.0",arg:[{name:"selector",optional:true,type:"String"}]}],replaceAll:[{added:"1.2",arg:[{name:"target",type:"Selector"}]}],replaceWith:[{added:"1.2",arg:[{name:"newContent",type:"String, Element, jQuery"}]},{added:"1.4",arg:[{name:"function",type:"Function"}]}],wrapInner:[{added:"1.2",arg:[{name:"wrappingElement",type:"String"}]},{added:"1.4",arg:[{name:"wrappingFunction",type:"Function"}]}],wrapAll:[{added:"1.2",arg:[{name:"wrappingElement",type:"String, Selector, Element, jQuery"}]}],wrap:[{added:"1.0",arg:[{name:"wrappingElement",type:"String, Selector, Element, jQuery"}]},{added:"1.4",arg:[{name:"function(index)",type:"Function"}]}],insertBefore:[{added:"1.0",arg:[{name:"target",type:"Selector, Element, jQuery"}]}],before:[{added:"1.0",arg:[{name:"content",type:"String, Element, jQuery"},{name:"content",type:"String, Element, Array, jQuery",optional:true,multiple:true}]},{added:"1.4",arg:[{name:"function",type:"Function"}]}],insertAfter:[{added:"1.0",arg:[{name:"target",type:"Selector, Element, jQuery"}]}],after:[{added:"1.0",arg:[{name:"content",type:"String, Element, jQuery"},{name:"content",type:"String, Element, Array, jQuery",optional:true,multiple:true}]},{added:"1.4",arg:[{name:"function(index)",type:"Function"}]}],prependTo:[{added:"1.0",arg:[{name:"target",type:"Selector, Element, jQuery"}]}],prepend:[{added:"1.0",arg:[{name:"content",type:"String, Element, jQuery"},{name:"content",type:"String, Element, jQuery",optional:true,multiple:true}]},{added:"1.4",arg:[{name:"function(index, html)",type:"Function"}]}],appendTo:[{added:"1.0",arg:[{name:"target",type:"Selector, Element, jQuery"}]}],append:[{added:"1.0",arg:[{name:"content",type:"String, Element, jQuery"},{name:"content",type:"String, Element, Array, jQuery",optional:true,multiple:true}]},{added:"1.4",arg:[{name:"function(index, html)",type:"Function"}]}],val:[{added:"1.0"},{added:"1.0",arg:[{name:"value",type:"String"}]},{added:"1.4",arg:[{name:"function(index, value)",type:"Function"}]}],html:[{added:"1.0"},{added:"1.0",arg:[{name:"htmlString",type:"String, Number"}]},{added:"1.4",arg:[{name:"function(index, oldhtml)",type:"Function"}]}],map:[{added:"1.2",arg:[{name:"callback(index, domElement)",type:"Function"}]}],is:[{added:"1.0",arg:[{name:"selector",type:"Selector"}]},{added:"1.6",arg:[{name:"element",type:"Element"}]},{added:"1.6",arg:[{name:"function(index)",type:"Function"}]},{added:"1.6",arg:[{name:"jQuery object",type:"Object"}]}],filter:[{added:"1.0",arg:[{name:"selector",type:"Selector"}]},{added:"1.0",arg:[{name:"function(index)",type:"Function"}]},{added:"1.4",arg:[{name:"jQuery object",type:"Object"}]},{added:"1.4",arg:[{name:"element",type:"Element"}]}],toggleClass:[{added:"1.0",arg:[{name:"className",type:"String"}]},{added:"1.3",arg:[{name:"className",type:"String"},{name:"switch",type:"Boolean"}]},{added:"1.4",arg:[{name:"function(index, class)",type:"Function"},{name:"switch",optional:true,type:"Boolean"}]}],removeClass:[{added:"1.0",arg:[{name:"className",optional:true,type:"String"}]},{added:"1.4",arg:[{name:"function(index, class)",type:"Function"}]}],hasClass:[{added:"1.2",arg:[{name:"className",type:"String"}]}],removeAttr:[{added:"1.0",arg:[{name:"attributeName",type:"String"}]}],attr:[{added:"1.0",arg:[{name:"map",type:"Map"}]},{added:"1.0",arg:[{name:"attributeName",type:"String"},{name:"value",type:"String,Number"}]},{added:"1.0",arg:[{name:"attributeName",type:"String"}]},{added:"1.1",arg:[{name:"attributeName",type:"String"},{name:"function(index, attr)",type:"Function"}]}],addClass:[{added:"1.0",arg:[{name:"className",type:"String"}]},{added:"1.4",arg:[{name:"function(index, currentClass)",type:"Function"}]}]}
  143. },
  144. api = lint.api,
  145. // Only cover certain fns under the jQ namespace
  146. coveredNamespace = /^(getJSON|extend|ajax|get|post|proxy|each|map|queue|ajax|ajaxSetup|removeData|data|pushStack)$/,
  147. version = _jQuery.fn.jquery,
  148. map = _jQuery.map,
  149. each = _jQuery.each,
  150. extend = _jQuery.extend,
  151. find = _jQuery.find,
  152. rootjQuery = _jQuery.rootjQuery,
  153. undefined,
  154. arrSlice = Array.prototype.slice,
  155. slice = function(a,s,e) {
  156. return a.length ? arrSlice.call(a, s || 0, e || a.length) : [];
  157. },
  158. compare = function(a,b) {
  159. // Compare two arrays
  160. var i = a.length;
  161. if (a.length !== b.length) {
  162. return false;
  163. }
  164. while (i--) {
  165. if (a[i] !== b[i]) {
  166. return false;
  167. }
  168. }
  169. return true;
  170. },
  171. isFunction = function(obj) {
  172. return toString.call(obj) === "[object Function]";
  173. },
  174. isArray = function(obj) {
  175. return toString.call(obj) === "[object Array]";
  176. },
  177. toString = Object.prototype.toString,
  178. typeToString = function(o) {
  179. if (!o) { return ""; }
  180. if (typeof o === 'string') {
  181. return '"' + o.replace(/"/g,'\\"') + '"';
  182. }
  183. if (isFunction(o)) {
  184. return 'function(){...}';
  185. }
  186. return o.toString();
  187. },
  188. shaveArray = function(arr) {
  189. arr = slice(arr);
  190. // Shave "undefined" off the end of args
  191. for (var i = arr.length; i--;) {
  192. if (arr[i] === undefined) {
  193. arr.splice(i, 1);
  194. } else {
  195. break;
  196. }
  197. }
  198. return arr;
  199. },
  200. // Type map
  201. types = {
  202. '*': function() {
  203. return true;
  204. },
  205. selector: function(o) {
  206. return this.string(o);
  207. },
  208. element: function(o) {
  209. return o && (!!o.nodeName || o === window || !!o.nodeType );
  210. },
  211. elements: function(o) {
  212. return this.element(o) || this.jquery(o) || this.array(o);
  213. },
  214. array: function(o) {
  215. // Just check that it's "array-like"
  216. return o && o.length !== undefined
  217. && typeof o !== 'string' && !isFunction(o);
  218. },
  219. jquery: function(o) {
  220. return o instanceof _jQuery;
  221. },
  222. 'jquery object': function(o) {
  223. return o instanceof _jQuery;
  224. },
  225. object: function(o) {
  226. return toString.call(o) === '[object Object]';
  227. },
  228. 'function': function(o) {
  229. return isFunction(o);
  230. },
  231. notfunction: function(o) {
  232. return !this['function'](o);
  233. },
  234. callback: function(o) {
  235. return isFunction(o);
  236. },
  237. string: function(o) {
  238. return typeof o === 'string';
  239. },
  240. number: function(o) {
  241. return typeof o === 'number' && !isNaN(o);
  242. },
  243. integer: function(o) {
  244. return this.number(o) && ~~o === o;
  245. },
  246. map: function(o) {
  247. return this.object(o);
  248. },
  249. options: function(o) {
  250. return this.object(o);
  251. },
  252. 'eventType': function(o) {
  253. return typeof o === 'string';
  254. },
  255. 'event': function(o) {
  256. return typeof o === 'event';
  257. },
  258. 'null': function(o) {
  259. return o === null;
  260. },
  261. 'boolean': function(o) {
  262. return typeof o === 'boolean';
  263. }
  264. },
  265. selectorCache = {},
  266. jQueryMethods = extend({}, _jQuery.fn),
  267. internal = false,
  268. fromInit = false;
  269. function logLocation() {
  270. // Attempt to log line number of error
  271. try {
  272. throw new Error();
  273. } catch(e) {
  274. if (e.stack) {
  275. lint.console.groupCollapsed(lint.langs[lint.lang].location);
  276. lint.console.log(
  277. e.stack
  278. // Remove everything before the file name and line number
  279. // plus, get rid of errors from jQuery.lint.js & any libs
  280. // from google's CDN (not perfect but should narrow it down)
  281. .replace(/^.+?\n|.+?(jquery\.lint\.js|http:\/\/ajax\.googleapis\.com).+?(\n|$)|.+?(?=@)/g, '')
  282. // Remove duplicates
  283. .replace(/(^|\n)(.+?)\n(?=\2(?:\n|$)|[\s\S]+?\n\2(?:\n|$))/g, '$1')
  284. );
  285. lint.console.groupEnd();
  286. }
  287. }
  288. }
  289. function isValidArgumentList(args, sig) {
  290. // Determine if argument list complies with
  291. // signature outlined in API.
  292. var matches = false,
  293. sigArg,
  294. argLength = args.length,
  295. nextIsOptional = false;
  296. if (version < sig.added) {
  297. // Too new
  298. return false;
  299. }
  300. if (!sig.arg) {
  301. return 0 === args.length;
  302. }
  303. if (!sig.arg[0] && (args.length > 1)) {
  304. return false;
  305. }
  306. for (
  307. var sigIndex = 0,
  308. argIndex = 0,
  309. fullLength = Math.max(argLength, sig.arg.length || 1);
  310. sigIndex < fullLength || argIndex < argLength;
  311. ++sigIndex
  312. ) {
  313. sigArg = sigIndex === 0 ? sig.arg[0] || sig.arg : sig.arg[sigIndex];
  314. if (!sigArg) {
  315. // Too many args
  316. return false;
  317. }
  318. matches = isValidType(sigArg.type, args[argIndex]);
  319. if (!matches) {
  320. if (sigArg.optional) {
  321. if (args[argIndex] === undefined || args[argIndex] === null) {
  322. ++argIndex;
  323. matches = true;
  324. }
  325. continue;
  326. } else {
  327. // Sig isn't optional
  328. return false;
  329. }
  330. }
  331. if (sigArg.multiple) {
  332. // If it's multiple, then carry on with the same
  333. // signature, but check that there are remaining
  334. // arguments
  335. --sigIndex;
  336. if (argIndex + 1 >= argLength) {
  337. break;
  338. }
  339. }
  340. ++argIndex;
  341. }
  342. return matches;
  343. }
  344. function isValidType(type, arg) {
  345. // Check that argument is of the right type
  346. // The types are specified within the API data
  347. var split = type.split(/,\s?/g),
  348. i = split.length,
  349. cur;
  350. while (i--) {
  351. cur = split[i].toLowerCase();
  352. if (types[cur] && types[cur](arg)) {
  353. return true;
  354. }
  355. }
  356. return false;
  357. }
  358. function runFunction(fn, args, isInternal, thisObj) {
  359. // Runs a function, while enabling/disabling
  360. // the 'internal' flag as necessary.
  361. var wasInternal = internal, ret;
  362. internal = isInternal;
  363. try {
  364. ret = fn.apply(thisObj, args);
  365. } catch(e) {
  366. internal = wasInternal;
  367. throw e;
  368. }
  369. internal = wasInternal;
  370. return ret;
  371. }
  372. function registerMethod(name, methodAPI) {
  373. var obj = /^jQuery\./.test(name) ? _jQuery : _jQuery.fn,
  374. methodName = name.replace(/^jQuery\./, '');
  375. obj[methodName] = (function(meth, name){
  376. return extend(function() {
  377. var args = slice(arguments),
  378. _internal = internal;
  379. // Cover functions so that the internal flag
  380. // is disabled before they are called
  381. each(args, function(i, fn){
  382. if (typeof fn == 'function') {
  383. args[i] = function() {
  384. /*Run it as non-internal*/
  385. return runFunction(fn, arguments, _internal, this);
  386. };
  387. }
  388. });
  389. return coverMethod.call(this, name, function(){
  390. // Run it as internal
  391. return runFunction(meth, args, true, this);
  392. }, args);
  393. }, meth);
  394. })(obj[methodName], name);
  395. if (methodAPI) {
  396. api[name] = methodAPI;
  397. }
  398. }
  399. lint.registerMethod = registerMethod;
  400. function coverMethod(name, meth, args) {
  401. if (name == 'jQuery' && args.length == 3 && typeof(args[2]) == 'object') {
  402. delete args[2];
  403. }
  404. args = shaveArray(args);
  405. var locale = lint.langs[lint.lang],
  406. sigs = api[name],
  407. _console = lint.console,
  408. self = this,
  409. i = 0,
  410. sig,
  411. specialCheckResults = (function(){
  412. // Perform special checks for current level and
  413. // all levels below current level.
  414. var lvl = lint.level + 1,
  415. results = [],
  416. check;
  417. while (lvl--) {
  418. if (checks[lvl] && (check = checks[lvl][name])) {
  419. if (types.array(check)) {
  420. each(check, function(i, chk){
  421. results.push(
  422. chk.apply(self, args)
  423. );
  424. });
  425. } else {
  426. results.push(
  427. check.apply(self, args)
  428. );
  429. }
  430. }
  431. }
  432. return results;
  433. }()),
  434. signatureMatch = false,
  435. sliced = slice(this, 0, 10);
  436. if (!sigs || !lint.level || internal) {
  437. return meth.apply(this, args);
  438. }
  439. if (this.length > 10) {
  440. sliced.push('...');
  441. }
  442. // Check all arguments passed to method for compliance
  443. // against the corresponding signature.
  444. while ((sig = sigs[i++])) {
  445. if ( isValidArgumentList(args, sig) ) {
  446. signatureMatch = true;
  447. break;
  448. }
  449. }
  450. if (!signatureMatch) {
  451. // Args !== signature
  452. _console.warn(locale.i