~bjornt/lazr-js/prefetch-yui-3.5

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/node/node-screen.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-01-14 23:32:29 UTC
  • mfrom: (197.1.7 yui-3.3.0)
  • Revision ID: launchpad@pqm.canonical.com-20110114233229-r6i4cazdiiw18o7p
Upgrade to YUI 3.3.0 [r=mars]

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.2.0
6
 
build: 2676
 
5
version: 3.3.0
 
6
build: 3167
7
7
*/
8
8
YUI.add('node-screen', function(Y) {
9
9
 
166
166
]);
167
167
 
168
168
/**
169
 
 * Returns a region object for the node 
 
169
 * Returns a region object for the node
170
170
 * @config region
171
171
 * @for Node
172
172
 * @type Node
186
186
        } else {
187
187
            region = Y.DOM.region(node);
188
188
        }
189
 
        return region; 
 
189
        return region;
190
190
    }
191
191
};
192
 
    
 
192
 
193
193
/**
194
 
 * Returns a region object for the node's viewport 
 
194
 * Returns a region object for the node's viewport
195
195
 * @config viewportRegion
196
196
 * @type Node
197
197
 */
205
205
 
206
206
// these need special treatment to extract 2nd node arg
207
207
/**
208
 
 * Compares the intersection of the node with another node or region 
209
 
 * @method intersect         
 
208
 * Compares the intersection of the node with another node or region
 
209
 * @method intersect
210
210
 * @for Node
211
211
 * @param {Node|Object} node2 The node or region to compare with.
212
 
 * @param {Object} altRegion An alternate region to use (rather than this node's). 
213
 
 * @return {Object} An object representing the intersection of the regions. 
 
212
 * @param {Object} altRegion An alternate region to use (rather than this node's).
 
213
 * @return {Object} An object representing the intersection of the regions.
214
214
 */
215
215
Y.Node.prototype.intersect = function(node2, altRegion) {
216
216
    var node1 = Y.Node.getDOMNode(this);
217
 
    if (node2 instanceof Y.Node) { // might be a region object
 
217
    if (Y.instanceOf(node2, Y.Node)) { // might be a region object
218
218
        node2 = Y.Node.getDOMNode(node2);
219
219
    }
220
 
    return Y.DOM.intersect(node1, node2, altRegion); 
 
220
    return Y.DOM.intersect(node1, node2, altRegion);
221
221
};
222
222
 
223
223
/**
224
224
 * Determines whether or not the node is within the giving region.
225
 
 * @method inRegion         
 
225
 * @method inRegion
226
226
 * @param {Node|Object} node2 The node or region to compare with.
227
 
 * @param {Boolean} all Whether or not all of the node must be in the region. 
228
 
 * @param {Object} altRegion An alternate region to use (rather than this node's). 
229
 
 * @return {Object} An object representing the intersection of the regions. 
 
227
 * @param {Boolean} all Whether or not all of the node must be in the region.
 
228
 * @param {Object} altRegion An alternate region to use (rather than this node's).
 
229
 * @return {Object} An object representing the intersection of the regions.
230
230
 */
231
231
Y.Node.prototype.inRegion = function(node2, all, altRegion) {
232
232
    var node1 = Y.Node.getDOMNode(this);
233
 
    if (node2 instanceof Y.Node) { // might be a region object
 
233
    if (Y.instanceOf(node2, Y.Node)) { // might be a region object
234
234
        node2 = Y.Node.getDOMNode(node2);
235
235
    }
236
 
    return Y.DOM.inRegion(node1, node2, all, altRegion); 
 
236
    return Y.DOM.inRegion(node1, node2, all, altRegion);
237
237
};
238
238
 
239
239
 
240
 
}, '3.2.0' ,{requires:['dom-screen']});
 
240
}, '3.3.0' ,{requires:['dom-screen']});