EventManager.html 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-EventManager'>/**
  19. </span> * @class Ext.EventManager
  20. * Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides
  21. * several useful events directly.
  22. * See {@link Ext.EventObject} for more details on normalized event objects.
  23. * @singleton
  24. */
  25. Ext.EventManager = new function() {
  26. var EventManager = this,
  27. doc = document,
  28. win = window,
  29. initExtCss = function() {
  30. // find the body element
  31. var bd = doc.body || doc.getElementsByTagName('body')[0],
  32. baseCSSPrefix = Ext.baseCSSPrefix,
  33. cls = [baseCSSPrefix + 'body'],
  34. htmlCls = [],
  35. supportsLG = Ext.supports.CSS3LinearGradient,
  36. supportsBR = Ext.supports.CSS3BorderRadius,
  37. resetCls = [],
  38. html,
  39. resetElementSpec;
  40. if (!bd) {
  41. return false;
  42. }
  43. html = bd.parentNode;
  44. function add (c) {
  45. cls.push(baseCSSPrefix + c);
  46. }
  47. //Let's keep this human readable!
  48. if (Ext.isIE) {
  49. add('ie');
  50. // very often CSS needs to do checks like &quot;IE7+&quot; or &quot;IE6 or 7&quot;. To help
  51. // reduce the clutter (since CSS/SCSS cannot do these tests), we add some
  52. // additional classes:
  53. //
  54. // x-ie7p : IE7+ : 7 &lt;= ieVer
  55. // x-ie7m : IE7- : ieVer &lt;= 7
  56. // x-ie8p : IE8+ : 8 &lt;= ieVer
  57. // x-ie8m : IE8- : ieVer &lt;= 8
  58. // x-ie9p : IE9+ : 9 &lt;= ieVer
  59. // x-ie78 : IE7 or 8 : 7 &lt;= ieVer &lt;= 8
  60. //
  61. if (Ext.isIE6) {
  62. add('ie6');
  63. } else { // ignore pre-IE6 :)
  64. add('ie7p');
  65. if (Ext.isIE7) {
  66. add('ie7');
  67. } else {
  68. add('ie8p');
  69. if (Ext.isIE8) {
  70. add('ie8');
  71. } else {
  72. add('ie9p');
  73. if (Ext.isIE9) {
  74. add('ie9');
  75. }
  76. }
  77. }
  78. }
  79. if (Ext.isIE6 || Ext.isIE7) {
  80. add('ie7m');
  81. }
  82. if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8) {
  83. add('ie8m');
  84. }
  85. if (Ext.isIE7 || Ext.isIE8) {
  86. add('ie78');
  87. }
  88. }
  89. if (Ext.isGecko) {
  90. add('gecko');
  91. if (Ext.isGecko3) {
  92. add('gecko3');
  93. }
  94. if (Ext.isGecko4) {
  95. add('gecko4');
  96. }
  97. if (Ext.isGecko5) {
  98. add('gecko5');
  99. }
  100. }
  101. if (Ext.isOpera) {
  102. add('opera');
  103. }
  104. if (Ext.isWebKit) {
  105. add('webkit');
  106. }
  107. if (Ext.isSafari) {
  108. add('safari');
  109. if (Ext.isSafari2) {
  110. add('safari2');
  111. }
  112. if (Ext.isSafari3) {
  113. add('safari3');
  114. }
  115. if (Ext.isSafari4) {
  116. add('safari4');
  117. }
  118. if (Ext.isSafari5) {
  119. add('safari5');
  120. }
  121. if (Ext.isSafari5_0) {
  122. add('safari5_0')
  123. }
  124. }
  125. if (Ext.isChrome) {
  126. add('chrome');
  127. }
  128. if (Ext.isMac) {
  129. add('mac');
  130. }
  131. if (Ext.isLinux) {
  132. add('linux');
  133. }
  134. if (!supportsBR) {
  135. add('nbr');
  136. }
  137. if (!supportsLG) {
  138. add('nlg');
  139. }
  140. // If we are not globally resetting scope, but just resetting it in a wrapper around
  141. // serarately rendered widgets, then create a common reset element for use when creating
  142. // measurable elements. Using a common DomHelper spec.
  143. if (Ext.scopeResetCSS) {
  144. // Create Ext.resetElementSpec for use in Renderable when wrapping top level Components.
  145. resetElementSpec = Ext.resetElementSpec = {
  146. cls: baseCSSPrefix + 'reset'
  147. };
  148. if (!supportsLG) {
  149. resetCls.push(baseCSSPrefix + 'nlg');
  150. }
  151. if (!supportsBR) {
  152. resetCls.push(baseCSSPrefix + 'nbr');
  153. }
  154. if (resetCls.length) {
  155. resetElementSpec.cn = {
  156. cls: resetCls.join(' ')
  157. };
  158. }
  159. Ext.resetElement = Ext.getBody().createChild(resetElementSpec);
  160. if (resetCls.length) {
  161. Ext.resetElement = Ext.get(Ext.resetElement.dom.firstChild);
  162. }
  163. }
  164. // Otherwise, the common reset element is the document body
  165. else {
  166. Ext.resetElement = Ext.getBody();
  167. add('reset');
  168. }
  169. // add to the parent to allow for selectors x-strict x-border-box, also set the isBorderBox property correctly
  170. if (html) {
  171. if (Ext.isStrict &amp;&amp; (Ext.isIE6 || Ext.isIE7)) {
  172. Ext.isBorderBox = false;
  173. }
  174. else {
  175. Ext.isBorderBox = true;
  176. }
  177. if(Ext.isBorderBox) {
  178. htmlCls.push(baseCSSPrefix + 'border-box');
  179. }
  180. if (Ext.isStrict) {
  181. htmlCls.push(baseCSSPrefix + 'strict');
  182. } else {
  183. htmlCls.push(baseCSSPrefix + 'quirks');
  184. }
  185. Ext.fly(html, '_internal').addCls(htmlCls);
  186. }
  187. Ext.fly(bd, '_internal').addCls(cls);
  188. return true;
  189. };
  190. Ext.apply(EventManager, {
  191. <span id='Ext-EventManager-property-hasBoundOnReady'> /**
  192. </span> * Check if we have bound our global onReady listener
  193. * @private
  194. */
  195. hasBoundOnReady: false,
  196. <span id='Ext-EventManager-property-hasFiredReady'> /**
  197. </span> * Check if fireDocReady has been called
  198. * @private
  199. */
  200. hasFiredReady: false,
  201. <span id='Ext-EventManager-property-deferReadyEvent'> /**
  202. </span> * Additionally, allow the 'DOM' listener thread to complete (usually desirable with mobWebkit, Gecko)
  203. * before firing the entire onReady chain (high stack load on Loader) by specifying a delay value
  204. * @default 1ms
  205. * @private
  206. */
  207. deferReadyEvent : 1,
  208. /*
  209. * diags: a list of event names passed to onReadyEvent (in chron order)
  210. * @private
  211. */
  212. onReadyChain : [],
  213. <span id='Ext-EventManager-property-readyEvent'> /**
  214. </span> * Holds references to any onReady functions
  215. * @private
  216. */
  217. readyEvent:
  218. (function () {
  219. var event = new Ext.util.Event();
  220. event.fire = function () {
  221. Ext._beforeReadyTime = Ext._beforeReadyTime || new Date().getTime();
  222. event.self.prototype.fire.apply(event, arguments);
  223. Ext._afterReadytime = new Date().getTime();
  224. };
  225. return event;
  226. }()),
  227. <span id='Ext-EventManager-property-idleEvent'> /**
  228. </span> * Fires when a DOM event handler finishes its run, just before returning to browser control.
  229. * This can be useful for performing cleanup, or upfdate tasks which need to happen only
  230. * after all code in an event handler has been run, but which should not be executed in a timer
  231. * due to the intervening browser reflow/repaint which would take place.
  232. *
  233. */
  234. idleEvent: new Ext.util.Event(),
  235. <span id='Ext-EventManager-method-isReadyPaused'> /**
  236. </span> * detects whether the EventManager has been placed in a paused state for synchronization
  237. * with external debugging / perf tools (PageAnalyzer)
  238. * @private
  239. */
  240. isReadyPaused: function(){
  241. return (/[?&amp;]ext-pauseReadyFire\b/i.test(location.search) &amp;&amp; !Ext._continueFireReady);
  242. },
  243. <span id='Ext-EventManager-method-bindReadyEvent'> /**
  244. </span> * Binds the appropriate browser event for checking if the DOM has loaded.
  245. * @private
  246. */
  247. bindReadyEvent: function() {
  248. if (EventManager.hasBoundOnReady) {
  249. return;
  250. }
  251. // Test scenario where Core is dynamically loaded AFTER window.load
  252. if ( doc.readyState == 'complete' ) { // Firefox4+ got support for this state, others already do.
  253. EventManager.onReadyEvent({
  254. type: doc.readyState || 'body'
  255. });
  256. } else {
  257. document.addEventListener('DOMContentLoaded', EventManager.onReadyEvent, false);
  258. window.addEventListener('load', EventManager.onReadyEvent, false);
  259. EventManager.hasBoundOnReady = true;
  260. }
  261. },
  262. onReadyEvent : function(e) {
  263. if (e &amp;&amp; e.type) {
  264. EventManager.onReadyChain.push(e.type);
  265. }
  266. if (EventManager.hasBoundOnReady) {
  267. document.removeEventListener('DOMContentLoaded', EventManager.onReadyEvent, false);
  268. window.removeEventListener('load', EventManager.onReadyEvent, false);
  269. }
  270. if (!Ext.isReady) {
  271. EventManager.fireDocReady();
  272. }
  273. },
  274. <span id='Ext-EventManager-method-fireDocReady'> /**
  275. </span> * We know the document is loaded, so trigger any onReady events.
  276. * @private
  277. */
  278. fireDocReady: function() {
  279. if (!Ext.isReady) {
  280. Ext._readyTime = new Date().getTime();
  281. Ext.isReady = true;
  282. Ext.supports.init();
  283. EventManager.onWindowUnload();
  284. EventManager.readyEvent.onReadyChain = EventManager.onReadyChain; //diags report
  285. if (Ext.isNumber(EventManager.deferReadyEvent)) {
  286. Ext.Function.defer(EventManager.fireReadyEvent, EventManager.deferReadyEvent);
  287. EventManager.hasDocReadyTimer = true;
  288. } else {
  289. EventManager.fireReadyEvent();
  290. }
  291. }
  292. },
  293. <span id='Ext-EventManager-method-fireReadyEvent'> /**
  294. </span> * Fires the ready event
  295. * @private
  296. */
  297. fireReadyEvent: function(){
  298. var readyEvent = EventManager.readyEvent;
  299. // Unset the timer flag here since other onReady events may be
  300. // added during the fire() call and we don't want to block them
  301. EventManager.hasDocReadyTimer = false;
  302. EventManager.isFiring = true;
  303. // Ready events are all single: true, if we get to the end
  304. // &amp; there are more listeners, it means they were added
  305. // inside some other ready event
  306. while (readyEvent.listeners.length &amp;&amp; !EventManager.isReadyPaused()) {
  307. readyEvent.fire();
  308. }
  309. EventManager.isFiring = false;
  310. EventManager.hasFiredReady = true;
  311. },
  312. <span id='Ext-EventManager-method-onDocumentReady'> /**
  313. </span> * Adds a listener to be notified when the document is ready (before onload and before images are loaded).
  314. *
  315. * @param {Function} fn The method the event invokes.
  316. * @param {Object} [scope] The scope (`this` reference) in which the handler function executes.
  317. * Defaults to the browser window.
  318. * @param {Object} [options] Options object as passed to {@link Ext.Element#addListener}.
  319. */
  320. onDocumentReady: function(fn, scope, options) {
  321. options = options || {};
  322. // force single, only ever fire it once
  323. options.single = true;
  324. EventManager.readyEvent.addListener(fn, scope, options);
  325. // If we're in the middle of firing, or we have a deferred timer
  326. // pending, drop out since the event will be fired later
  327. if (!(EventManager.isFiring || EventManager.hasDocReadyTimer)) {
  328. if (Ext.isReady) {
  329. EventManager.fireReadyEvent();
  330. } else {
  331. EventManager.bindReadyEvent();
  332. }
  333. }
  334. },
  335. // --------------------- event binding ---------------------
  336. <span id='Ext-EventManager-property-stoppedMouseDownEvent'> /**
  337. </span> * Contains a list of all document mouse downs, so we can ensure they fire even when stopEvent is called.
  338. * @private
  339. */
  340. stoppedMouseDownEvent: new Ext.util.Event(),
  341. <span id='Ext-EventManager-property-propRe'> /**
  342. </span> * Options to parse for the 4th argument to addListener.
  343. * @private
  344. */
  345. propRe: /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate|freezeEvent)$/,
  346. <span id='Ext-EventManager-method-getId'> /**
  347. </span> * Get the id of the element. If one has not been assigned, automatically assign it.
  348. * @param {HTMLElement/Ext.Element} element The element to get the id for.
  349. * @return {String} id
  350. */
  351. getId : function(element) {
  352. var id;
  353. element = Ext.getDom(element);
  354. if (element === doc || element === win) {
  355. id = element === doc ? Ext.documentId : Ext.windowId;
  356. }
  357. else {
  358. id = Ext.id(element);
  359. }
  360. if (!Ext.cache[id]) {
  361. Ext.addCacheEntry(id, null, element);
  362. }
  363. return id;
  364. },
  365. <span id='Ext-EventManager-method-prepareListenerConfig'> /**
  366. </span> * Convert a &quot;config style&quot; listener into a set of flat arguments so they can be passed to addListener
  367. * @private
  368. * @param {Object} element The element the event is for
  369. * @param {Object} event The event configuration
  370. * @param {Object} isRemove True if a removal should be performed, otherwise an add will be done.
  371. */
  372. prepareListenerConfig: function(element, config, isRemove) {
  373. var propRe = EventManager.propRe,
  374. key, value, args;
  375. // loop over all the keys in the object
  376. for (key in config) {
  377. if (config.hasOwnProperty(key)) {
  378. // if the key is something else then an event option
  379. if (!propRe.test(key)) {
  380. value = config[key];
  381. // if the value is a function it must be something like click: function() {}, scope: this
  382. // which means that there might be multiple event listeners with shared options
  383. if (typeof value == 'function') {
  384. // shared options
  385. args = [element, key, value, config.scope, config];
  386. } else {
  387. // if its not a function, it must be an object like click: {fn: function() {}, scope: this}
  388. args = [element, key, value.fn, value.scope, value];
  389. }
  390. if (isRemove) {
  391. EventManager.removeListener.apply(EventManager, args);
  392. } else {
  393. EventManager.addListener.apply(EventManager, args);
  394. }
  395. }
  396. }
  397. }
  398. },
  399. mouseEnterLeaveRe: /mouseenter|mouseleave/,
  400. <span id='Ext-EventManager-method-normalizeEvent'> /**
  401. </span> * Normalize cross browser event differences
  402. * @private
  403. * @param {Object} eventName The event name
  404. * @param {Object} fn The function to execute
  405. * @return {Object} The new event name/function
  406. */
  407. normalizeEvent: function(eventName, fn) {
  408. if (EventManager.mouseEnterLeaveRe.test(eventName) &amp;&amp; !Ext.supports.MouseEnterLeave) {
  409. if (fn) {
  410. fn = Ext.Function.createInterceptor(fn, EventManager.contains);
  411. }
  412. eventName = eventName == 'mouseenter' ? 'mouseover' : 'mouseout';
  413. } else if (eventName == 'mousewheel' &amp;&amp; !Ext.supports.MouseWheel &amp;&amp; !Ext.isOpera) {
  414. eventName = 'DOMMouseScroll';
  415. }
  416. return {
  417. eventName: eventName,
  418. fn: fn
  419. };
  420. },
  421. <span id='Ext-EventManager-method-contains'> /**
  422. </span> * Checks whether the event's relatedTarget is contained inside (or &lt;b&gt;is&lt;/b&gt;) the element.
  423. * @private
  424. * @param {Object} event
  425. */
  426. contains: function(event) {
  427. var parent = event.browserEvent.currentTarget,
  428. child = EventManager.getRelatedTarget(event);
  429. if (parent &amp;&amp; parent.firstChild) {
  430. while (child) {
  431. if (child === parent) {
  432. return false;
  433. }
  434. child = child.parentNode;
  435. if (child &amp;&amp; (child.nodeType != 1)) {
  436. child = null;
  437. }
  438. }
  439. }
  440. return true;
  441. },
  442. <span id='Ext-EventManager-method-addListener'> /**
  443. </span> * Appends an event handler to an element. The shorthand version {@link #on} is equivalent. Typically you will
  444. * use {@link Ext.Element#addListener} directly on an Element in favor of calling this version.
  445. * @param {String/HTMLElement} el The html element or id to assign the event handler to.
  446. * @param {String} eventName The name of the event to listen for.
  447. * @param {Function} handler The handler function the event invokes. This function is passed
  448. * the following parameters:&lt;ul&gt;
  449. * &lt;li&gt;evt : EventObject&lt;div class=&quot;sub-desc&quot;&gt;The {@link Ext.EventObject EventObject} describing the event.&lt;/div&gt;&lt;/li&gt;
  450. * &lt;li&gt;t : Element&lt;div class=&quot;sub-desc&quot;&gt;The {@link Ext.Element Element} which was the target of the event.
  451. * Note that this may be filtered by using the &lt;tt&gt;delegate&lt;/tt&gt; option.&lt;/div&gt;&lt;/li&gt;
  452. * &lt;li&gt;o : Object&lt;div class=&quot;sub-desc&quot;&gt;The options object from the addListener call.&lt;/div&gt;&lt;/li&gt;
  453. * &lt;/ul&gt;
  454. * @param {Object} scope (optional) The scope (&lt;b&gt;&lt;code&gt;this&lt;/code&gt;&lt;/b&gt; reference) in which the handler function is executed. &lt;b&gt;Defaults to the Element&lt;/b&gt;.
  455. * @param {Object} options (optional) An object containing handler configuration properties.
  456. * This may contain any of the following properties:&lt;ul&gt;
  457. * &lt;li&gt;scope : Object&lt;div class=&quot;sub-desc&quot;&gt;The scope (&lt;b&gt;&lt;code&gt;this&lt;/code&gt;&lt;/b&gt; reference) in which the handler function is executed. &lt;b&gt;Defaults to the Element&lt;/b&gt;.&lt;/div&gt;&lt;/li&gt;
  458. * &lt;li&gt;delegate : String&lt;div class=&quot;sub-desc&quot;&gt;A simple selector to filter the target or look for a descendant of the target&lt;/div&gt;&lt;/li&gt;
  459. * &lt;li&gt;stopEvent : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to stop the event. That is stop propagation, and prevent the default action.&lt;/div&gt;&lt;/li&gt;
  460. * &lt;li&gt;preventDefault : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to prevent the default action&lt;/div&gt;&lt;/li&gt;
  461. * &lt;li&gt;stopPropagation : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to prevent event propagation&lt;/div&gt;&lt;/li&gt;
  462. * &lt;li&gt;normalized : Boolean&lt;div class=&quot;sub-desc&quot;&gt;False to pass a browser event to the handler function instead of an Ext.EventObject&lt;/div&gt;&lt;/li&gt;
  463. * &lt;li&gt;delay : Number&lt;div class=&quot;sub-desc&quot;&gt;The number of milliseconds to delay the invocation of the handler after te event fires.&lt;/div&gt;&lt;/li&gt;
  464. * &lt;li&gt;single : Boolean&lt;div class=&quot;sub-desc&quot;&gt;True to add a handler to handle just the next firing of the event, and then remove itself.&lt;/div&gt;&lt;/li&gt;
  465. * &lt;li&gt;buffer : Number&lt;div class=&quot;sub-desc&quot;&gt;Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
  466. * by the specified number of milliseconds. If the event fires again within that time, the original
  467. * handler is &lt;em&gt;not&lt;/em&gt; invoked, but the new handler is scheduled in its place.&lt;/div&gt;&lt;/li&gt;
  468. * &lt;li&gt;target : Element&lt;div class=&quot;sub-desc&quot;&gt;Only call the handler if the event was fired on the target Element, &lt;i&gt;not&lt;/i&gt; if the event was bubbled up from a child node.&lt;/div&gt;&lt;/li&gt;
  469. * &lt;/ul&gt;&lt;br&gt;
  470. * &lt;p&gt;See {@link Ext.Element#addListener} for examples of how to use these options.&lt;/p&gt;
  471. */
  472. addListener: function(element, eventName, fn, scope, options) {
  473. // Check if we've been passed a &quot;config style&quot; event.
  474. if (typeof eventName !== 'string') {
  475. EventManager.prepareListenerConfig(element, eventName);
  476. return;
  477. }
  478. var dom = element.dom || Ext.getDom(element),
  479. bind, wrap;
  480. //&lt;debug&gt;
  481. if (!fn) {
  482. Ext.Error.raise({
  483. sourceClass: 'Ext.EventManager',
  484. sourceMethod: 'addListener',
  485. targetElement: element,
  486. eventName: eventName,
  487. msg: 'Error adding &quot;' + eventName + '\&quot; listener. The handler function is undefined.'
  488. });
  489. }
  490. //&lt;/debug&gt;
  491. // create the wrapper function
  492. options = options || {};
  493. bind = EventManager.normalizeEvent(eventName, fn);
  494. wrap = EventManager.createListenerWrap(dom, eventName, bind.fn, scope, options);
  495. if (dom.attachEvent) {
  496. dom.attachEvent('on' + bind.eventName, wrap);
  497. } else {
  498. dom.addEventListener(bind.eventName, wrap, options.capture || false);
  499. }
  500. if (dom == doc &amp;&amp; eventName == 'mousedown') {
  501. EventManager.stoppedMouseDownEvent.addListener(wrap);
  502. }
  503. // add all required data into the event cache
  504. EventManager.getEventListenerCache(element.dom ? element : dom, eventName).push({
  505. fn: fn,
  506. wrap: wrap,
  507. scope: scope
  508. });
  509. },
  510. <span id='Ext-EventManager-method-removeListener'> /**
  511. </span> * Removes an event handler from an element. The shorthand version {@link #un} is equivalent. Typically
  512. * you will use {@link Ext.Element#removeListener} directly on an Element in favor of calling this version.
  513. * @param {String/HTMLElement} el The id or html element from which to remove the listener.
  514. * @param {String} eventName The name of the event.
  515. * @param {Function} fn The handler function to remove. &lt;b&gt;This must be a reference to the function passed into the {@link #addListener} call.&lt;/b&gt;
  516. * @param {Object} scope If a scope (&lt;b&gt;&lt;code&gt;this&lt;/code&gt;&lt;/b&gt; reference) was specified when the listener was added,
  517. * then this must refer to the same object.
  518. */
  519. removeListener : function(element, eventName, fn, scope) {
  520. // handle our listener config object syntax
  521. if (typeof eventName !== 'string') {
  522. EventManager.prepareListenerConfig(element, eventName, true);
  523. return;
  524. }
  525. var dom = Ext.getDom(element),
  526. el = element.dom ? element : Ext.get(dom),
  527. cache = EventManager.getEventListenerCache(el, eventName),
  528. bindName = EventManager.normalizeEvent(eventName).eventName,
  529. i = cache.length, j,
  530. listener, wrap, tasks;
  531. while (i--) {
  532. listener = cache[i];
  533. if (listener &amp;&amp; (!fn || listener.fn == fn) &amp;&amp; (!scope || listener.scope === scope)) {
  534. wrap = listener.wrap;
  535. // clear buffered calls
  536. if (wrap.task) {
  537. clearTimeout(wrap.task);
  538. delete wrap.task;
  539. }
  540. // clear delayed calls
  541. j = wrap.tasks &amp;&amp; wrap.tasks.length;
  542. if (j) {
  543. while (j--) {
  544. clearTimeout(wrap.tasks[j]);
  545. }
  546. delete wrap.tasks;
  547. }
  548. if (dom.detachEvent) {
  549. dom.detachEvent('on' + bindName, wrap);
  550. } else {
  551. dom.removeEventListener(bindName, wrap, false);
  552. }
  553. if (wrap &amp;&amp; dom == doc &amp;&amp; eventName == 'mousedown') {
  554. EventManager.stoppedMouseDownEvent.removeListener(wrap);
  555. }
  556. // remove listener from cache
  557. Ext.Array.erase(cache, i, 1);
  558. }
  559. }
  560. },
  561. <span id='Ext-EventManager-method-removeAll'> /**
  562. </span> * Removes all event handers from an element. Typically you will use {@link Ext.Element#removeAllListeners}
  563. * directly on an Element in favor of calling this version.
  564. * @param {String/HTMLElement} el The id or html element from which to remove all event handlers.
  565. */
  566. removeAll : function(element) {
  567. var el = element.dom ? element : Ext.get(element),
  568. cache, events, eventName;
  569. if (!el) {
  570. return;
  571. }
  572. cache = (el.$cache || el.getCache());
  573. events = cache.events;
  574. for (eventName in events) {
  575. if (events.hasOwnProperty(eventName)) {
  576. EventManager.removeListener(el, eventName);
  577. }
  578. }
  579. cache.events = {};
  580. },
  581. <span id='Ext-EventManager-method-purgeElement'> /**
  582. </span> * Recursively removes all previous added listeners from an element and its children. Typically you will use {@link Ext.Element#purgeAllListeners}
  583. * directly on an Element in favor of calling this version.
  584. * @param {String/HTMLElement} el The id or html element from which to remove all event handlers.
  585. * @param {String} eventName (optional) The name of the event.
  586. */
  587. purgeElement : function(element, eventName) {
  588. var dom = Ext.getDom(element),
  589. i = 0, len;
  590. if (eventName) {
  591. EventManager.removeListener(element, eventName);
  592. }
  593. else {
  594. EventManager.removeAll(element);
  595. }
  596. if (dom &amp;&amp; dom.childNodes) {
  597. for (len = element.childNodes.length; i &lt; len; i++) {
  598. EventManager.purgeElement(element.childNodes[i], eventName);
  599. }
  600. }
  601. },
  602. <span id='Ext-EventManager-method-createListenerWrap'> /**
  603. </span> * Create the wrapper function for the event
  604. * @private
  605. * @param {HTMLElement} dom The dom element
  606. * @param {String} ename The event name
  607. * @param {Function} fn The function to execute
  608. * @param {Object} scope The scope to execute callback in
  609. * @param {Object} options The options
  610. * @return {Function} the wrapper function
  611. */
  612. createListenerWrap : function(dom, ename, fn, scope, options) {
  613. options = options || {};
  614. var f, gen, escapeRx = /\\/g, wrap = function(e, args) {
  615. // Compile the implementation upon first firing
  616. if (!gen) {
  617. f = ['if(!' + Ext.name + ') {return;}'];
  618. if(options.buffer || options.delay || options.freezeEvent) {
  619. f.push('e = new X.EventObjectImpl(e, ' + (options.freezeEvent ? 'true' : 'false' ) + ');');
  620. } else {
  621. f.push('e = X.EventObject.setEvent(e);');
  622. }
  623. if (options.delegate) {
  624. // double up '\' characters so escape sequences survive the
  625. // string-literal translation
  626. f.push('var result, t = e.getTarget(&quot;' + (options.delegate + '').replace(escapeRx, '\\\\') + '&quot;, this);');
  627. f.push('if(!t) {return;}');
  628. } else {
  629. f.push('var t = e.target, result;');
  630. }
  631. if (options.target) {
  632. f.push('if(e.target !== options.target) {return;}');
  633. }
  634. if(options.stopEvent) {
  635. f.push('e.stopEvent();');
  636. } else {
  637. if(options.preventDefault) {
  638. f.push('e.preventDefault();');
  639. }
  640. if(options.stopPropagation) {
  641. f.push('e.stopPropagation();');
  642. }
  643. }
  644. if(options.normalized === false) {
  645. f.push('e = e.browserEvent;');
  646. }
  647. if(options.buffer) {
  648. f.push('(wrap.task &amp;&amp; clearTimeout(wrap.task));');
  649. f.push('wrap.task = setTimeout(function() {');
  650. }
  651. if(options.delay) {
  652. f.push('wrap.tasks = wrap.tasks || [];');
  653. f.push('wrap.tasks.push(setTimeout(function() {');
  654. }
  655. // finally call the actual handler fn
  656. f.push('result = fn.call(scope || dom, e, t, options);');
  657. if(options.single) {
  658. f.push('evtMgr.removeListener(dom, ename, fn, scope);');
  659. }
  660. // Fire the global idle event for all events except mousemove which is too common, and
  661. // fires too frequently and fast to be use in tiggering onIdle processing.
  662. if (ename !== 'mousemove') {
  663. f.push('if (evtMgr.idleEvent.listeners.length) {');
  664. f.push('evtMgr.idleEvent.fire();');
  665. f.push('}');
  666. }
  667. if(options.delay) {
  668. f.push('}, ' + options.delay + '));');
  669. }
  670. if(options.buffer) {
  671. f.push('}, ' + options.buffer + ');');
  672. }
  673. f.push('return result;')
  674. gen = Ext.cacheableFunctionFactory('e', 'options', 'fn', 'scope', 'ename', 'dom', 'wrap', 'args', 'X', 'evtMgr', f.join('\n'));
  675. }
  676. return gen.call(dom, e, options, fn, scope, ename, dom, wrap, args, Ext, EventManager);
  677. };
  678. return wrap;
  679. },
  680. <span id='Ext-EventManager-method-getEventListenerCache'> /**
  681. </span> * Get the event cache for a particular element for a particular event
  682. * @private
  683. * @param {HTMLElement} element The element
  684. * @param {Object} eventName The event name
  685. * @return {Array} The events for the element
  686. */
  687. getEventListenerCache : function(element, eventName) {
  688. var elementCache, eventCache;
  689. if (!element) {
  690. return [];
  691. }
  692. if (element.$cache) {
  693. elementCache = element.$cache;
  694. } else {
  695. // getId will populate the cache for this element if it isn't already present
  696. elementCache = Ext.cache[EventManager.getId(element)];
  697. }
  698. eventCache = elementCache.events || (elementCache.events = {});
  699. return eventCache[eventName] || (eventCache[eventName] = []);
  700. },
  701. // --------------------- utility methods ---------------------
  702. mouseLeaveRe: /(mouseout|mouseleave)/,
  703. mouseEnterRe: /(mouseover|mouseenter)/,
  704. <span id='Ext-EventManager-method-stopEvent'> /**
  705. </span> * Stop the event (preventDefault and stopPropagation)
  706. * @param {Event} The event to stop
  707. */
  708. stopEvent: function(event) {
  709. EventManager.stopPropagation(event);
  710. EventManager.preventDefault(event);
  711. },
  712. <span id='Ext-EventManager-method-stopPropagation'> /**
  713. </span> * Cancels bubbling of the event.
  714. * @param {Event} The event to stop bubbling.
  715. */
  716. stopPropagation: function(event) {
  717. event = event.browserEvent || event;
  718. if (event.stopPropagation) {
  719. event.stopPropagation();
  720. } else {
  721. event.cancelBubble = true;
  722. }
  723. },
  724. <span id='Ext-EventManager-method-preventDefault'> /**
  725. </span> * Prevents the browsers default handling of the event.
  726. * @param {Event} The event to prevent the default
  727. */
  728. preventDefault: function(event) {
  729. event = event.browserEvent || event;
  730. if (event.preventDefault) {
  731. event.preventDefault();
  732. } else {
  733. event.returnValue = false;
  734. // Some keys events require setting the keyCode to -1 to be prevented
  735. try {
  736. // all ctrl + X and F1 -&gt; F12
  737. if (event.ctrlKey || event.keyCode &gt; 111 &amp;&amp; event.keyCode &lt; 124) {
  738. event.keyCode = -1;
  739. }
  740. } catch (e) {
  741. // see this outdated document http://support.microsoft.com/kb/934364/en-us for more info
  742. }
  743. }
  744. },
  745. <span id='Ext-EventManager-method-getRelatedTarget'> /**
  746. </span> * Gets the related target from the event.
  747. * @param {Object} event The event
  748. * @return {HTMLElement} The related target.
  749. */
  750. getRelatedTarget: function(event) {
  751. event = event.browserEvent || event;
  752. var target = event.relatedTarget;
  753. if (!target) {
  754. if (EventManager.mouseLeaveRe.test(event.type)) {
  755. target = event.toElement;
  756. } else if (EventManager.mouseEnterRe.test(event.type)) {
  757. target = event.fromElement;
  758. }
  759. }
  760. return EventManager.resolveTextNode(target);
  761. },
  762. <span id='Ext-EventManager-method-getPageX'> /**
  763. </span> * Gets the x coordinate from the event
  764. * @param {Object} event The event
  765. * @return {Number} The x coordinate
  766. */
  767. getPageX: function(event) {
  768. return EventManager.getPageXY(event)[0];
  769. },
  770. <span id='Ext-EventManager-method-getPageY'> /**
  771. </span> * Gets the y coordinate from the event
  772. * @param {Object} event The event
  773. * @return {Number} The y coordinate
  774. */
  775. getPageY: function(event) {
  776. return EventManager.getPageXY(event)[1];
  777. },
  778. <span id='Ext-EventManager-method-getPageXY'> /**
  779. </span> * Gets the x &amp; y coordinate from the event
  780. * @param {Object} event The event
  781. * @return {Number[]} The x/y coordinate
  782. */
  783. getPageXY: function(event) {
  784. event = event.browserEvent || event;
  785. var x = event.pageX,
  786. y = event.pageY,
  787. docEl = doc.documentElement,
  788. body = doc.body;
  789. // pageX/pageY not available (undefined, not null), use clientX/clientY instead
  790. if (!x &amp;&amp; x !== 0) {
  791. x = event.clientX + (docEl &amp;&amp; docEl.scrollLeft || body &amp;&amp; body.scrollLeft || 0) - (docEl &amp;&amp; docEl.clientLeft || body &amp;&amp; body.clientLeft || 0);
  792. y = event.clientY + (docEl &amp;&amp; docEl.scrollTop || body &amp;&amp; body.scrollTop || 0) - (docEl &amp;&amp; docEl.clientTop || body &amp;&amp; body.clientTop || 0);
  793. }
  794. return [x, y];
  795. },
  796. <span id='Ext-EventManager-method-getTarget'> /**
  797. </span> * Gets the target of the event.
  798. * @param {Object} event The event
  799. * @return {HTMLElement} target
  800. */
  801. getTarget: function(event) {
  802. event = event.browserEvent || event;
  803. return EventManager.resolveTextNode(event.target || event.srcElement);
  804. },
  805. // technically no need to browser sniff this, however it makes
  806. // no sense to check this every time, for every event, whether
  807. // the string is equal.
  808. <span id='Ext-EventManager-method-resolveTextNode'> /**
  809. </span> * Resolve any text nodes accounting for browser differences.
  810. * @private
  811. * @param {HTMLElement} node The node
  812. * @return {HTMLElement} The resolved node
  813. */
  814. resolveTextNode: Ext.isGecko ?
  815. function(node) {
  816. if (!node) {
  817. return;
  818. }
  819. // work around firefox bug, https://bugzilla.mozilla.org/show_bug.cgi?id=101197
  820. var s = HTMLElement.prototype.toString.call(node);
  821. if (s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]') {
  822. return;
  823. }
  824. return node.nodeType == 3 ? node.parentNode: node;
  825. }: function(node) {
  826. return node &amp;&amp; node.nodeType == 3 ? node.parentNode: node;
  827. },
  828. // --------------------- custom event binding ---------------------
  829. // Keep track of the current width/height
  830. curWidth: 0,
  831. curHeight: 0,
  832. <span id='Ext-EventManager-method-onWindowResize'> /**
  833. </span> * Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 milliseconds),
  834. * passes new viewport width and height to handlers.
  835. * @param {Function} fn The handler function the window resize event invokes.
  836. * @param {Object} scope The scope (&lt;code&gt;this&lt;/code&gt; reference) in which the handler function executes. Defaults to the browser window.
  837. * @param {Boolean} options Options object as passed to {@link Ext.Element#addListener}
  838. */
  839. onWindowResize: function(fn, scope, options) {
  840. var resize = EventManager.resizeEvent;
  841. if (!resize) {
  842. EventManager.resizeEvent = resize = new Ext.util.Event();
  843. EventManager.on(win, 'resize', EventManager.fireResize, null, {buffer: 100});
  844. }
  845. resize.addListener(fn, scope, options);
  846. },
  847. <span id='Ext-EventManager-method-fireResize'> /**
  848. </span> * Fire the resize event.
  849. * @private
  850. */
  851. fireResize: function() {
  852. var w = Ext.Element.getViewWidth(),
  853. h = Ext.Element.getViewHeight();
  854. //whacky problem in IE where the resize event will sometimes fire even though the w/h are the same.
  855. if (EventManager.curHeight != h || EventManager.curWidth != w) {
  856. EventManager.curHeight = h;
  857. EventManager.curWidth = w;
  858. EventManager.resizeEvent.fire(w, h);
  859. }
  860. },
  861. <span id='Ext-EventManager-method-removeResizeListener'> /**
  862. </span> * Removes the passed window resize listener.
  863. * @param {Function} fn The method the event invokes
  864. * @param {Object} scope The scope of handler
  865. */
  866. removeResizeListener: function(fn, scope) {
  867. var resize = EventManager.resizeEvent;
  868. if (resize) {
  869. resize.removeListener(fn, scope);
  870. }
  871. },
  872. <span id='Ext-EventManager-method-onWindowUnload'> /**
  873. </span> * Adds a listener to be notified when the browser window is unloaded.
  874. * @param {Function} fn The handler function the window unload event invokes.
  875. * @param {Object} scope The scope (&lt;code&gt;this&lt;/code&gt; reference) in which the handler function executes. Defaults to the browser window.
  876. * @param {Boolean} options Options object as passed to {@link Ext.Element#addListener}
  877. */
  878. onWindowUnload: function(fn, scope, options) {
  879. var unload = EventManager.unloadEvent;
  880. if (!unload) {
  881. EventManager.unloadEvent = unload = new Ext.util.Event();
  882. EventManager.addListener(win, 'unload', EventManager.fireUnload);
  883. }
  884. if (fn) {
  885. unload.addListener(fn, scope, options);
  886. }
  887. },
  888. <span id='Ext-EventManager-method-fireUnload'> /**
  889. </span> * Fires the unload event for items bound with onWindowUnload
  890. * @private
  891. */
  892. fireUnload: function() {
  893. // wrap in a try catch, could have some problems during unload
  894. try {
  895. // relinquish references.
  896. doc = win = undefined;
  897. var gridviews, i, ln,
  898. el, cache;
  899. EventManager.unloadEvent.fire();
  900. // Work around FF3 remembering the last scroll position when refreshing the grid and then losing grid view
  901. if (Ext.isGecko3) {
  902. gridviews = Ext.ComponentQuery.query('gridview');
  903. i = 0;
  904. ln = gridviews.length;
  905. for (; i &lt; ln; i++) {
  906. gridviews[i].scrollToTop();
  907. }
  908. }
  909. // Purge all elements in the cache
  910. cache = Ext.cache;
  911. for (el in cache) {
  912. if (cache.hasOwnProperty(el)) {
  913. EventManager.removeAll(el);
  914. }
  915. }
  916. } catch(e) {
  917. }
  918. },
  919. <span id='Ext-EventManager-method-removeUnloadListener'> /**
  920. </span> * Removes the passed window unload listener.
  921. * @param {Function} fn The method the event invokes
  922. * @param {Object} scope The scope of handler
  923. */
  924. removeUnloadListener: function(fn, scope) {
  925. var unload = EventManager.unloadEvent;
  926. if (unload) {
  927. unload.removeListener(fn, scope);
  928. }
  929. },
  930. <span id='Ext-EventManager-property-useKeyDown'> /**
  931. </span> * note 1: IE fires ONLY the keydown event on specialkey autorepeat
  932. * note 2: Safari &lt; 3.1, Gecko (Mac/Linux) &amp; Opera fire only the keypress event on specialkey autorepeat
  933. * (research done by Jan Wolter at http://unixpapa.com/js/key.html)
  934. * @private
  935. */
  936. useKeyDown: Ext.isWebKit ?
  937. parseInt(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1], 10) &gt;= 525 :
  938. !((Ext.isGecko &amp;&amp; !Ext.isWindows) || Ext.isOpera),
  939. <span id='Ext-EventManager-method-getKeyEvent'> /**
  940. </span> * Indicates which event to use for getting key presses.
  941. * @return {String} The appropriate event name.
  942. */
  943. getKeyEvent: function() {
  944. return EventManager.useKeyDown ? 'keydown' : 'keypress';
  945. }
  946. });
  947. // route &quot;&lt; ie9-Standards&quot; to a legacy IE onReady implementation
  948. if(!('addEventListener' in document) &amp;&amp; document.attachEvent) {
  949. Ext.apply( EventManager, {
  950. /* Customized implementation for Legacy IE. The default implementation is configured for use
  951. * with all other 'standards compliant' agents.
  952. * References: http://javascript.nwbox.com/IEContentLoaded/
  953. * licensed courtesy of http://developer.yahoo.com/yui/license.html
  954. */
  955. <span id='Ext-EventManager-method-pollScroll'> /**
  956. </span> * This strategy has minimal benefits for Sencha solutions that build themselves (ie. minimal initial page markup).
  957. * However, progressively-enhanced pages (with image content and/or embedded frames) will benefit the most from it.
  958. * Browser timer resolution is too poor to ensure a doScroll check more than once on a page loaded with minimal
  959. * assets (the readystatechange event 'complete' usually beats the doScroll timer on a 'lightly-loaded' initial document).
  960. */
  961. pollScroll : function() {
  962. var scrollable = true;
  963. try {
  964. document.documentElement.doScroll('left');
  965. } catch(e) {
  966. scrollable = false;
  967. }
  968. // on IE8, when running within an iFrame, document.body is not immediately available
  969. if (scrollable &amp;&amp; document.body) {
  970. EventManager.onReadyEvent({
  971. type:'doScroll'
  972. });
  973. } else {
  974. /*
  975. * minimize thrashing --
  976. * adjusted for setTimeout's close-to-minimums (not too low),
  977. * as this method SHOULD always be called once initially
  978. */
  979. EventManager.scrollTimeout = setTimeout(EventManager.pollScroll, 20);
  980. }
  981. return scrollable;
  982. },
  983. <span id='Ext-EventManager-property-scrollTimeout'> /**
  984. </span> * Timer for doScroll polling
  985. * @private
  986. */
  987. scrollTimeout: null,
  988. /* @private
  989. */
  990. readyStatesRe : /complete/i,
  991. /* @private
  992. */
  993. checkReadyState: function() {
  994. var state = document.readyState;
  995. if (EventManager.readyStatesRe.test(state)) {
  996. EventManager.onReadyEvent({
  997. type: state
  998. });
  999. }
  1000. },
  1001. bindReadyEvent: function() {
  1002. var topContext = true;
  1003. if (EventManager.hasBoundOnReady) {
  1004. return;
  1005. }
  1006. //are we in an IFRAME? (doScroll ineffective here)
  1007. try {
  1008. topContext = window.frameElement === undefined;
  1009. } catch(e) {
  1010. // If we throw an exception, it means we're probably getting access denied,
  1011. // which means we're in an iframe cross domain.
  1012. topContext = false;
  1013. }
  1014. if (!topContext || !doc.documentElement.doScroll) {
  1015. EventManager.pollScroll = Ext.emptyFn; //then noop this test altogether
  1016. }
  1017. // starts doScroll polling if necessary
  1018. if (EventManager.pollScroll() === true) {
  1019. return;
  1020. }
  1021. // Core is loaded AFTER initial document write/load ?
  1022. if (doc.readyState == 'complete' ) {
  1023. EventManager.onReadyEvent({type: 'already ' + (doc.readyState || 'body') });
  1024. } else {
  1025. doc.attachEvent('onreadystatechange', EventManager.checkReadyState);
  1026. window.attachEvent('onload', EventManager.onReadyEvent);
  1027. EventManager.hasBoundOnReady = true;
  1028. }
  1029. },
  1030. onReadyEvent : function(e) {
  1031. if (e &amp;&amp; e.type) {
  1032. EventManager.onReadyChain.push(e.type);
  1033. }
  1034. if (EventManager.hasBoundOnReady) {
  1035. document.detachEvent('onreadystatechange', EventManager.checkReadyState);
  1036. window.detachEvent('onload', EventManager.onReadyEvent);
  1037. }
  1038. if (Ext.isNumber(EventManager.scrollTimeout)) {
  1039. clearTimeout(EventManager.scrollTimeout);
  1040. delete EventManager.scrollTimeout;
  1041. }
  1042. if (!Ext.isReady) {
  1043. EventManager.fireDocReady();
  1044. }
  1045. },
  1046. //diags: a list of event types passed to onReadyEvent (in chron order)
  1047. onReadyChain : []
  1048. });
  1049. }
  1050. <span id='Ext-method-onReady'> /**
  1051. </span> * Alias for {@link Ext.Loader#onReady Ext.Loader.onReady} with withDomReady set to true
  1052. * @member Ext
  1053. * @method onReady
  1054. */
  1055. Ext.onReady = function(fn, scope, options) {
  1056. Ext.Loader.onReady(fn, scope, true, options);
  1057. };
  1058. <span id='Ext-method-onDocumentReady'> /**
  1059. </span> * Alias for {@link Ext.EventManager#onDocumentReady Ext.EventManager.onDocumentReady}
  1060. * @member Ext
  1061. * @method onDocumentReady
  1062. */
  1063. Ext.onDocumentReady = EventManager.onDocumentReady;
  1064. <span id='Ext-EventManager-method-on'> /**
  1065. </span> * Alias for {@link Ext.EventManager#addListener Ext.EventManager.addListener}
  1066. * @member Ext.EventManager
  1067. * @method on
  1068. */
  1069. EventManager.on = EventManager.addListener;
  1070. <span id='Ext-EventManager-method-un'> /**
  1071. </span> * Alias for {@link Ext.EventManager#removeListener Ext.EventManager.removeListener}
  1072. * @member Ext.EventManager
  1073. * @method un
  1074. */
  1075. EventManager.un = EventManager.removeListener;
  1076. Ext.onReady(initExtCss);
  1077. };
  1078. </pre>
  1079. </body>
  1080. </html>