diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-08-03 11:47:45 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-08-04 12:31:57 +0200 |
| commit | bca7afe3ce93708d84f6241f9e242b22c899e6dd (patch) | |
| tree | e5681fcdee38a90fcedf2f63b6c434fa76adcb45 /addons/web_editor/static | |
| parent | 4fa1d2e46d4836f6124b0ce352cc9d5f6a584e7f (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_editor/static')
| -rw-r--r-- | addons/web_editor/static/src/js/snippets.editor.js | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js index 2353fcaee2f..a0bfb8b300c 100644 --- a/addons/web_editor/static/src/js/snippets.editor.js +++ b/addons/web_editor/static/src/js/snippets.editor.js @@ -4,6 +4,7 @@ odoo.define('web_editor.snippet.editor', function (require) { var Class = require('web.Class'); var ajax = require('web.ajax'); var core = require('web.core'); +var dom = require('web.dom'); var Widget = require('web.Widget'); var editor = require('web_editor.editor'); var animation = require('web_editor.snippets.animation'); @@ -98,7 +99,7 @@ data.Class = Widget.extend({ return $from.closest(selector, parentNode); }, all: function ($from) { - return $from ? cssFind($from, selector) : $(selector); + return $from ? dom.cssFind($from, selector) : $(selector); }, is: function ($from) { return $from.is(selector); @@ -121,31 +122,16 @@ data.Class = Widget.extend({ }); }, all: is_children ? function ($from) { - return cssFind($from || self.$editable, selector); + return dom.cssFind($from || self.$editable, selector); } : function ($from) { $from = $from || self.$editable; - return $from.filter(selector).add(cssFind($from, selector)); + return $from.filter(selector).add(dom.cssFind($from, selector)); }, is: function ($from) { return $from.is(selector); } }; } - - /** - * 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} - */ - function cssFind($from, selector) { - return $from.find('*').filter(selector); - } }, fetch_snippet_templates: function () { |
