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">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
15 * @class Ext.Element
\r
17 Ext.Element.addMethods({
\r
18 <div id="method-Ext.Element-isScrollable"></div>/**
\r
19 * Returns true if this element is scrollable.
\r
22 isScrollable : function(){
\r
24 return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
\r
27 <div id="method-Ext.Element-scrollTo"></div>/**
\r
28 * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
\r
29 * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.
\r
30 * @param {Number} value The new scroll value.
\r
31 * @return {Element} this
\r
33 scrollTo : function(side, value){
\r
34 this.dom["scroll" + (/top/i.test(side) ? "Top" : "Left")] = value;
\r
38 <div id="method-Ext.Element-getScroll"></div>/**
\r
39 * Returns the current scroll position of the element.
\r
40 * @return {Object} An object containing the scroll position in the format {left: (scrollLeft), top: (scrollTop)}
\r
42 getScroll : function(){
\r
46 docElement = doc.documentElement,
\r
51 if(d == doc || d == body){
\r
52 if(Ext.isIE && Ext.isStrict){
\r
53 l = docElement.scrollLeft;
\r
54 t = docElement.scrollTop;
\r
56 l = window.pageXOffset;
\r
57 t = window.pageYOffset;
\r
59 ret = {left: l || (body ? body.scrollLeft : 0), top: t || (body ? body.scrollTop : 0)};
\r
61 ret = {left: d.scrollLeft, top: d.scrollTop};
\r