summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/dom.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-08-03 11:47:45 +0200
committerqsm-odoo <qsm@odoo.com>2017-08-04 12:31:57 +0200
commitbca7afe3ce93708d84f6241f9e242b22c899e6dd (patch)
treee5681fcdee38a90fcedf2f63b6c434fa76adcb45 /addons/web/static/src/js/core/dom.js
parent4fa1d2e46d4836f6124b0ce352cc9d5f6a584e7f (diff)
[REF] web, web_editor: expose 'cssFind' function
The web_editor app uses a 'cssFind' function but does not expose it. It makes sense to move it in the web app in the 'dom' utility function set.
Diffstat (limited to 'addons/web/static/src/js/core/dom.js')
-rw-r--r--addons/web/static/src/js/core/dom.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/js/core/dom.js
index 0ce30e2ac4e..8ad094b0ae8 100644
--- a/addons/web/static/src/js/core/dom.js
+++ b/addons/web/static/src/js/core/dom.js
@@ -105,6 +105,20 @@ return {
}
},
/**
+ * jQuery find function behavior is:
+ * $('A').find('A B') <=> $('A A B')
+ * The searches behavior to find options' DOM needs to be
+ * $('A').find('A B') <=> $('A B')
+ * This is what this function does.
+ *
+ * @param {jQuery} $from - the jQuery element(s) from which to search
+ * @param {string} selector - the CSS selector to match
+ * @returns {jQuery}
+ */
+ cssFind: function ($from, selector) {
+ return $from.find('*').filter(selector);
+ },
+ /**
* Detaches widgets from the DOM and performs their on_detach_callback()
*
* @param {Array} [to_detach] array of {widget: w, callback_args: args} such