Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
7 component/standalone/website/test/tests.js
@@ -726,6 +726,13 @@ testrunner.define({
testGetWindow : function()
{
this.assertEquals(window, q.getWindow(q("#sandbox")[0]));
+ },
+
+ testGetDocument : function()
+ {
+ this.assertEquals(document, q.getDocument(q("#sandbox")[0]));
+ this.assertEquals(document, q.getDocument(window));
+ this.assertEquals(document, q.getDocument(document));
}
});
View
17 framework/source/class/qx/module/Event.js
@@ -77,7 +77,10 @@ qx.Bootstrap.define("qx.module.Event", {
if (!el.__bound) {
el.__bound = {};
}
- el.__bound[id] = bound;
+ if (!el.__bound[type]) {
+ el.__bound[type] = {};
+ }
+ el.__bound[type][id] = bound;
}
if (!context) {
// store a reference to the dynamically created context so we know
@@ -104,21 +107,21 @@ qx.Bootstrap.define("qx.module.Event", {
off : function(type, listener, context) {
for (var j=0; j < this.length; j++) {
var el = this[j];
- if (!el.__bound) {
+ if (!el.__bound || !type in el.__bound) {
el.__emitter.off(type, listener, context);
}
else {
- for (var id in el.__bound) {
- if (el.__bound[id].original == listener) {
+ for (var id in el.__bound[type]) {
+ if (el.__bound[type][id].original == listener) {
var storedContext = typeof el.__ctx !== "undefined" && el.__ctx[id];
if (!context && storedContext) {
context = el.__ctx[id];
}
- el.__emitter.off(type, el.__bound[id], context);
+ el.__emitter.off(type, el.__bound[type][id], context);
// remove the native listener
- qx.bom.Event.removeNativeListener(el, type, el.__bound[id]);
- delete el.__bound[id];
+ qx.bom.Event.removeNativeListener(el, type, el.__bound[type][id]);
+ delete el.__bound[type][id];
if (storedContext) {
delete el.__ctx[id];
View
20 framework/source/class/qx/module/Traversing.js
@@ -20,6 +20,8 @@
/* ************************************************************************
#require(qx.dom.Hierarchy#getSiblings)
+#require(qx.dom.Hierarchy#getNextSiblings)
+#require(qx.dom.Hierarchy#getPreviousSiblings)
************************************************************************ */
/**
@@ -325,8 +327,7 @@ qx.Bootstrap.define("qx.module.Traversing", {
* @return {qx.Collection} New set containing next siblings
*/
getNext : function(selector) {
- var Hierarchy = qx.dom.Hierarchy;
- var found = this.map(Hierarchy.getNextElementSibling, Hierarchy);
+ var found = this.map(qx.dom.Hierarchy.getNextElementSibling, Hierarchy);
if (selector) {
found = qx.bom.Selector.matches(selector, found);
}
@@ -383,8 +384,7 @@ qx.Bootstrap.define("qx.module.Traversing", {
* @return {qx.Collection} New set containing previous siblings
*/
getPrev : function(selector) {
- var Hierarchy = qx.dom.Hierarchy;
- var found = this.map(Hierarchy.getPreviousElementSibling, Hierarchy);
+ var found = this.map(qx.dom.Hierarchy.getPreviousElementSibling, Hierarchy);
if (selector) {
found = qx.bom.Selector.matches(selector, found);
}
@@ -524,6 +524,17 @@ qx.Bootstrap.define("qx.module.Traversing", {
/**
+ * Returns the owner document of the given node
+ *
+ * @param node {Node } Node to get the document for
+ * @return {Document|null} The document of the given DOM node
+ */
+ getDocument : function(node) {
+ return qx.dom.Node.getDocument(node);
+ },
+
+
+ /**
* Helper function that iterates over a set of items and applies the given
* qx.dom.Hierarchy method to each entry, storing the results in a new Array.
* Duplicates are removed and the items are filtered if a selector is
@@ -591,6 +602,7 @@ qx.Bootstrap.define("qx.module.Traversing", {
"isElement" : statics.isElement,
"isNode" : statics.isNode,
"isDocument" : statics.isDocument,
+ "getDocument" : statics.getDocument,
"getWindow" : statics.getWindow
});
}

No commit comments for this range

Something went wrong with that request. Please try again.