ShadowPool.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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-ShadowPool'>/**
  19. </span> * Private utility class that manages the internal Shadow cache.
  20. * @private
  21. */
  22. Ext.define('Ext.ShadowPool', {
  23. singleton: true,
  24. requires: ['Ext.DomHelper'],
  25. markup: (function() {
  26. return Ext.String.format(
  27. '&lt;div class=&quot;{0}{1}-shadow&quot; role=&quot;presentation&quot;&gt;&lt;/div&gt;',
  28. Ext.baseCSSPrefix,
  29. Ext.isIE &amp;&amp; !Ext.supports.CSS3BoxShadow ? 'ie' : 'css'
  30. );
  31. }()),
  32. shadows: [],
  33. pull: function() {
  34. var sh = this.shadows.shift();
  35. if (!sh) {
  36. sh = Ext.get(Ext.DomHelper.insertHtml(&quot;beforeBegin&quot;, document.body.firstChild, this.markup));
  37. sh.autoBoxAdjust = false;
  38. }
  39. return sh;
  40. },
  41. push: function(sh) {
  42. this.shadows.push(sh);
  43. },
  44. reset: function() {
  45. var shadows = [].concat(this.shadows),
  46. s,
  47. sLen = shadows.length;
  48. for (s = 0; s &lt; sLen; s++) {
  49. shadows[s].remove();
  50. }
  51. this.shadows = [];
  52. }
  53. });</pre>
  54. </body>
  55. </html>