Merge -r6634:HEAD from ../branches/dom.
* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel]
* Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel]
* Make Element#readAttribute('title') work in Opera. [Tobie Langel]
* Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel]
* Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel]
* Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel]
* Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]
2007-05-12 05:01:56 +00:00
|
|
|
/*------------------------------- DEPRECATED -------------------------------*/
|
|
|
|
|
|
|
|
var Toggle = { display: Element.toggle };
|
|
|
|
|
|
|
|
Element.Methods.childOf = Element.Methods.descendantOf;
|
|
|
|
|
|
|
|
var Insertion = {
|
|
|
|
Before: function(element, content) {
|
2007-06-02 15:08:50 +00:00
|
|
|
return Element.insert(element, {before:content});
|
Merge -r6634:HEAD from ../branches/dom.
* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel]
* Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel]
* Make Element#readAttribute('title') work in Opera. [Tobie Langel]
* Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel]
* Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel]
* Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel]
* Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]
2007-05-12 05:01:56 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
Top: function(element, content) {
|
2007-06-02 15:08:50 +00:00
|
|
|
return Element.insert(element, {top:content});
|
Merge -r6634:HEAD from ../branches/dom.
* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel]
* Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel]
* Make Element#readAttribute('title') work in Opera. [Tobie Langel]
* Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel]
* Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel]
* Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel]
* Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]
2007-05-12 05:01:56 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
Bottom: function(element, content) {
|
2007-06-02 15:08:50 +00:00
|
|
|
return Element.insert(element, {bottom:content});
|
Merge -r6634:HEAD from ../branches/dom.
* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel]
* Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel]
* Make Element#readAttribute('title') work in Opera. [Tobie Langel]
* Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel]
* Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel]
* Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel]
* Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]
2007-05-12 05:01:56 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
After: function(element, content) {
|
2007-06-02 15:08:50 +00:00
|
|
|
return Element.insert(element, {after:content});
|
Merge -r6634:HEAD from ../branches/dom.
* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel]
* Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel]
* Make Element#readAttribute('title') work in Opera. [Tobie Langel]
* Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel]
* Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel]
* Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel]
* Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]
2007-05-12 05:01:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
|
|
|
|
|
|
|
|
// This should be moved to script.aculo.us; notice the deprecated methods
|
|
|
|
// further below, that map to the newer Element methods.
|
|
|
|
var Position = {
|
|
|
|
// set to true if needed, warning: firefox performance problems
|
|
|
|
// NOT neeeded for page scrolling, only if draggable contained in
|
|
|
|
// scrollable elements
|
|
|
|
includeScrollOffsets: false,
|
|
|
|
|
|
|
|
// must be called before calling withinIncludingScrolloffset, every time the
|
|
|
|
// page is scrolled
|
|
|
|
prepare: function() {
|
|
|
|
this.deltaX = window.pageXOffset
|
|
|
|
|| document.documentElement.scrollLeft
|
|
|
|
|| document.body.scrollLeft
|
|
|
|
|| 0;
|
|
|
|
this.deltaY = window.pageYOffset
|
|
|
|
|| document.documentElement.scrollTop
|
|
|
|
|| document.body.scrollTop
|
|
|
|
|| 0;
|
|
|
|
},
|
|
|
|
|
|
|
|
// caches x/y coordinate pair to use with overlap
|
|
|
|
within: function(element, x, y) {
|
|
|
|
if (this.includeScrollOffsets)
|
|
|
|
return this.withinIncludingScrolloffsets(element, x, y);
|
|
|
|
this.xcomp = x;
|
|
|
|
this.ycomp = y;
|
|
|
|
this.offset = Element.cumulativeOffset(element);
|
|
|
|
|
|
|
|
return (y >= this.offset[1] &&
|
|
|
|
y < this.offset[1] + element.offsetHeight &&
|
|
|
|
x >= this.offset[0] &&
|
|
|
|
x < this.offset[0] + element.offsetWidth);
|
|
|
|
},
|
|
|
|
|
|
|
|
withinIncludingScrolloffsets: function(element, x, y) {
|
|
|
|
var offsetcache = Element.cumulativeScrollOffset(element);
|
|
|
|
|
|
|
|
this.xcomp = x + offsetcache[0] - this.deltaX;
|
|
|
|
this.ycomp = y + offsetcache[1] - this.deltaY;
|
|
|
|
this.offset = Element.cumulativeOffset(element);
|
|
|
|
|
|
|
|
return (this.ycomp >= this.offset[1] &&
|
|
|
|
this.ycomp < this.offset[1] + element.offsetHeight &&
|
|
|
|
this.xcomp >= this.offset[0] &&
|
|
|
|
this.xcomp < this.offset[0] + element.offsetWidth);
|
|
|
|
},
|
|
|
|
|
|
|
|
// within must be called directly before
|
|
|
|
overlap: function(mode, element) {
|
|
|
|
if (!mode) return 0;
|
|
|
|
if (mode == 'vertical')
|
|
|
|
return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
|
|
|
|
element.offsetHeight;
|
|
|
|
if (mode == 'horizontal')
|
|
|
|
return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
|
|
|
|
element.offsetWidth;
|
|
|
|
},
|
|
|
|
|
|
|
|
// Deprecation layer -- use newer Element methods now (1.5.2).
|
|
|
|
|
|
|
|
cumulativeOffset: Element.Methods.cumulativeOffset,
|
|
|
|
|
|
|
|
positionedOffset: Element.Methods.positionedOffset,
|
|
|
|
|
|
|
|
absolutize: function(element) {
|
|
|
|
Position.prepare();
|
|
|
|
return Element.absolutize(element);
|
|
|
|
},
|
|
|
|
|
|
|
|
relativize: function(element) {
|
|
|
|
Position.prepare();
|
|
|
|
return Element.relativize(element);
|
|
|
|
},
|
|
|
|
|
|
|
|
realOffset: Element.Methods.cumulativeScrollOffset,
|
|
|
|
|
|
|
|
offsetParent: Element.Methods.getOffsetParent,
|
|
|
|
|
|
|
|
page: Element.Methods.viewportOffset,
|
|
|
|
|
|
|
|
clone: function(source, target, options) {
|
|
|
|
options = options || {};
|
|
|
|
return Element.clonePosition(target, source, options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------*/
|