Fix #6673 - mobile cards issues
[roojs1] / Roo / bootstrap / Element.js
1 /*
2  * - LGPL
3  *
4  * element
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Element
10  * @extends Roo.bootstrap.Component
11  * Bootstrap Element class
12  * @cfg {String} html contents of the element
13  * @cfg {String} tag tag of the element
14  * @cfg {String} cls class of the element
15  * @cfg {Boolean} preventDefault (true|false) default false
16  * @cfg {Boolean} clickable (true|false) default false
17  * 
18  * @constructor
19  * Create a new Element
20  * @param {Object} config The config object
21  */
22
23 Roo.bootstrap.Element = function(config){
24     Roo.bootstrap.Element.superclass.constructor.call(this, config);
25     
26     this.addEvents({
27         // raw events
28         /**
29          * @event click
30          * When a element is chick
31          * @param {Roo.bootstrap.Element} this
32          * @param {Roo.EventObject} e
33          */
34         "click" : true 
35         
36       
37     });
38 };
39
40 Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
41     
42     tag: 'div',
43     cls: '',
44     html: '',
45     preventDefault: false, 
46     clickable: false,
47     tapedTwice : false,
48     
49     getAutoCreate : function(){
50         
51         var cfg = {
52             tag: this.tag,
53             // cls: this.cls, double assign in parent class Component.js :: onRender
54             html: this.html
55         };
56         
57         return cfg;
58     },
59     
60     initEvents: function() 
61     {
62         Roo.bootstrap.Element.superclass.initEvents.call(this);
63         
64         if(this.clickable){
65             this.el.on('click', this.onClick, this);
66         }
67         
68         
69     },
70     
71     onClick : function(e)
72     {
73         if(this.preventDefault){
74             e.preventDefault();
75         }
76         
77         this.fireEvent('dblclick', this, e);
78     },
79     
80     
81     
82
83     
84     
85     getValue : function()
86     {
87         return this.el.dom.innerHTML;
88     },
89     
90     setValue : function(value)
91     {
92         this.el.dom.innerHTML = value;
93     }
94    
95 });
96
97  
98
99