Ox.Element: add methods childrenElements, findElements, nextElement, nextElements, parentElement, parentElements, prevElement, prevElements
This commit is contained in:
parent
1bec2d29ae
commit
27d8a6682e
1 changed files with 51 additions and 1 deletions
|
@ -340,6 +340,10 @@ Ox.Element = function(options, self) {
|
|||
return that;
|
||||
};
|
||||
|
||||
that.childrenElements = function() {
|
||||
return that.children().filter(Ox.UI.isOxElement).map(Ox.UI.getOxElement);
|
||||
};
|
||||
|
||||
/*@
|
||||
defaults <function> Gets or sets the default options for an element object
|
||||
({key: value, ...}) -> <obj> This element object
|
||||
|
@ -360,6 +364,10 @@ Ox.Element = function(options, self) {
|
|||
return ret;
|
||||
};
|
||||
|
||||
that.findElements = function() {
|
||||
return Ox.map(that.find('.OxElement'), Ox.UI.getOxElement);
|
||||
};
|
||||
|
||||
/*@
|
||||
gainFocus <function> Makes an element object gain focus
|
||||
() -> <obj> This element object
|
||||
|
@ -386,6 +394,14 @@ Ox.Element = function(options, self) {
|
|||
return that;
|
||||
};
|
||||
|
||||
that.nextElement = function() {
|
||||
return that.nextElements()[0];
|
||||
};
|
||||
|
||||
that.nextElements = function() {
|
||||
return that.nextAll().filter(Ox.UI.isOxElement).map(Ox.UI.getOxElement);
|
||||
};
|
||||
|
||||
/*@
|
||||
onMessage <f> Adds message handlers (if the element is an iframe)
|
||||
(callback) -> <o> This element
|
||||
|
@ -439,6 +455,14 @@ Ox.Element = function(options, self) {
|
|||
return Ox.getset(self.options, arguments, update, that);
|
||||
};
|
||||
|
||||
that.parentElement = function() {
|
||||
return Ox.last(that.parentElements());
|
||||
};
|
||||
|
||||
that.parentElements = function() {
|
||||
return that.parents().filter(Ox.UI.isOxElement).map(Ox.UI.getOxElement);
|
||||
};
|
||||
|
||||
/*@
|
||||
postMessage <f> Sends a message (if the element is an iframe)
|
||||
(event, data) -> This element
|
||||
|
@ -452,8 +476,16 @@ Ox.Element = function(options, self) {
|
|||
return that;
|
||||
};
|
||||
|
||||
that.prevElement = function() {
|
||||
return Ox.last(that.prevElements());
|
||||
};
|
||||
|
||||
that.prevElements = function() {
|
||||
return that.prevAll().filter(Ox.UI.isOxElement).map(Ox.UI.getOxElement);
|
||||
};
|
||||
|
||||
/*@
|
||||
removeElement <f> Removes an element object and its event handler
|
||||
remove <f> Removes an element object and its event handler
|
||||
() -> <o> This element
|
||||
@*/
|
||||
that.remove = function(remove) {
|
||||
|
@ -469,6 +501,24 @@ Ox.Element = function(options, self) {
|
|||
return that;
|
||||
};
|
||||
|
||||
/*
|
||||
that.remove = function() {
|
||||
[that].concat(that.find('.OxElement'))
|
||||
.map(Ox.UI.getOxElement).forEach(function($element) {
|
||||
$element.removeElement();
|
||||
});
|
||||
that[0].parentNode.removeChild(this[0]);
|
||||
return that;
|
||||
}
|
||||
|
||||
that.removeElement = function() {
|
||||
delete Ox.$elements[that.oxid];
|
||||
Ox.Focus.remove(that);
|
||||
self.unbindKeyboard();
|
||||
return that;
|
||||
};
|
||||
*/
|
||||
|
||||
/*@
|
||||
setElement <f> set $element
|
||||
($element) -> <o> This element
|
||||
|
|
Loading…
Reference in a new issue