You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.8 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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-CompositeElementLite'>/**
  19. </span> * @class Ext.CompositeElementLite
  20. */
  21. Ext.apply(Ext.CompositeElementLite.prototype, {
  22. addElements : function(els, root){
  23. if(!els){
  24. return this;
  25. }
  26. if(typeof els == &quot;string&quot;){
  27. els = Ext.Element.selectorFunction(els, root);
  28. }
  29. var yels = this.elements;
  30. Ext.each(els, function(e) {
  31. yels.push(Ext.get(e));
  32. });
  33. return this;
  34. },
  35. <span id='Ext-CompositeElementLite-method-first'> /**
  36. </span> * Returns the first Element
  37. * @return {Ext.Element}
  38. */
  39. first : function(){
  40. return this.item(0);
  41. },
  42. <span id='Ext-CompositeElementLite-method-last'> /**
  43. </span> * Returns the last Element
  44. * @return {Ext.Element}
  45. */
  46. last : function(){
  47. return this.item(this.getCount()-1);
  48. },
  49. <span id='Ext-CompositeElementLite-method-contains'> /**
  50. </span> * Returns true if this composite contains the passed element
  51. * @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection.
  52. * @return Boolean
  53. */
  54. contains : function(el){
  55. return this.indexOf(el) != -1;
  56. },
  57. <span id='Ext-CompositeElementLite-method-removeElement'> /**
  58. </span> * Removes the specified element(s).
  59. * @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite
  60. * or an array of any of those.
  61. * @param {Boolean} removeDom (optional) True to also remove the element from the document
  62. * @return {CompositeElement} this
  63. */
  64. removeElement : function(keys, removeDom){
  65. var me = this,
  66. els = this.elements,
  67. el;
  68. Ext.each(keys, function(val){
  69. if ((el = (els[val] || els[val = me.indexOf(val)]))) {
  70. if(removeDom){
  71. if(el.dom){
  72. el.remove();
  73. }else{
  74. Ext.removeNode(el);
  75. }
  76. }
  77. els.splice(val, 1);
  78. }
  79. });
  80. return this;
  81. }
  82. });
  83. </pre>
  84. </body>
  85. </html>