3
<title>The source code</title>
4
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7
<body onload="prettyPrint();">
8
<pre class="prettyprint lang-js">/**
11
Ext.Element.addMethods({
12
<div id="method-Ext.Element-swallowEvent"></div>/**
13
* Stops the specified event(s) from bubbling and optionally prevents the default action
14
* @param {String/Array} eventName an event / array of events to stop from bubbling
15
* @param {Boolean} preventDefault (optional) true to prevent the default action too
16
* @return {Ext.Element} this
18
swallowEvent : function(eventName, preventDefault){
26
if(Ext.isArray(eventName)){
27
Ext.each(eventName, function(e) {
36
<div id="method-Ext.Element-relayEvent"></div>/**
37
* Create an event handler on this element such that when the event fires and is handled by this element,
38
* it will be relayed to another object (i.e., fired again as if it originated from that object instead).
39
* @param {String} eventName The type of event to relay
40
* @param {Object} object Any object that extends {@link Ext.util.Observable} that will provide the context
41
* for firing the relayed event
43
relayEvent : function(eventName, observable){
44
this.on(eventName, function(e){
45
observable.fireEvent(eventName, e);
49
<div id="method-Ext.Element-clean"></div>/**
50
* Removes worthless text nodes
51
* @param {Boolean} forceReclean (optional) By default the element
52
* keeps track if it has been cleaned already so
53
* you can call this over and over. However, if you update the element and
54
* need to force a reclean, you can pass true.
56
clean : function(forceReclean){
62
if(Ext.Element.data(dom, 'isCleaned') && forceReclean !== true){
67
var nx = n.nextSibling;
68
if(n.nodeType == 3 && !/\S/.test(n.nodeValue)){
75
Ext.Element.data(dom, 'isCleaned', true);
79
<div id="method-Ext.Element-load"></div>/**
80
* Direct access to the Updater {@link Ext.Updater#update} method. The method takes the same object
81
* parameter as {@link Ext.Updater#update}
82
* @return {Ext.Element} this
85
var um = this.getUpdater();
86
um.update.apply(um, arguments);
90
<div id="method-Ext.Element-getUpdater"></div>/**
91
* Gets this element's {@link Ext.Updater Updater}
92
* @return {Ext.Updater} The Updater
94
getUpdater : function(){
95
return this.updateManager || (this.updateManager = new Ext.Updater(this));
98
<div id="method-Ext.Element-update"></div>/**
99
* Update the innerHTML of this element, optionally searching for and processing scripts
100
* @param {String} html The new HTML
101
* @param {Boolean} loadScripts (optional) True to look for and process scripts (defaults to false)
102
* @param {Function} callback (optional) For async script loading you can be notified when the update completes
103
* @return {Ext.Element} this
105
update : function(html, loadScripts, callback){
108
if(loadScripts !== true){
109
this.dom.innerHTML = html;
110
if(Ext.isFunction(callback)){
119
html += '<span id="' + id + '"></span>';
121
Ext.lib.Event.onAvailable(id, function(){
123
hd = DOC.getElementsByTagName("head")[0],
124
re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
125
srcRe = /\ssrc=([\'\"])(.*?)\1/i,
126
typeRe = /\stype=([\'\"])(.*?)\1/i,
134
while((match = re.exec(html))){
136
srcMatch = attrs ? attrs.match(srcRe) : false;
137
if(srcMatch && srcMatch[2]){
138
s = DOC.createElement("script");
140
typeMatch = attrs.match(typeRe);
141
if(typeMatch && typeMatch[2]){
142
s.type = typeMatch[2];
145
}else if(match[2] && match[2].length > 0){
146
if(window.execScript) {
147
window.execScript(match[2]);
149
window.eval(match[2]);
153
el = DOC.getElementById(id);
154
if(el){Ext.removeNode(el);}
155
if(Ext.isFunction(callback)){
159
dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
163
<div id="method-Ext.Element-createProxy"></div>/**
164
* Creates a proxy element of this element
165
* @param {String/Object} config The class name of the proxy element or a DomHelper config object
166
* @param {String/HTMLElement} renderTo (optional) The element or element id to render the proxy to (defaults to document.body)
167
* @param {Boolean} matchBox (optional) True to align and size the proxy to this element now (defaults to false)
168
* @return {Ext.Element} The new proxy element
170
createProxy : function(config, renderTo, matchBox){
171
config = Ext.isObject(config) ? config : {tag : "div", cls: config};
174
proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
175
Ext.DomHelper.insertBefore(me.dom, config, true);
177
if(matchBox && me.setBox && me.getBox){ // check to make sure Element.position.js is loaded
178
proxy.setBox(me.getBox());
184
Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater;
187
Ext.Element.uncache = function(el){
188
for(var i = 0, a = arguments, len = a.length; i < len; i++) {
190
delete Ext.Element.cache[a[i].id || a[i]];
b'\\ No newline at end of file'