diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-09-17 09:40:50 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-09-17 09:40:50 +0200 |
| commit | c09e7544c328e0805d28b2483fdfd3a4510922a7 (patch) | |
| tree | 4a4154e4b5a826089838321ae9b5988199edb0d3 /addons/website/static/src | |
| parent | 3b89501d5e6c9a5c89a7d8fbba65c4f5a5c127e7 (diff) | |
[IMP] website snippet: increase speed of dom_filter
bzr revid: chm@openerp.com-20130917074050-ab22448v4x1d26lf
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/website.snippets.js | 13 | ||||
| -rw-r--r-- | addons/website/static/src/xml/website.snippets.xml | 6 |
2 files changed, 13 insertions, 6 deletions
diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index 815fa143f0d..85e8ede2981 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -73,10 +73,17 @@ $("body").on('DOMNodeInserted', hack_to_add_snippet_id); }, dom_filter: function (dom) { - var $errordom = $("#oe_manipulators, #website-top-navbar"); - return $(dom).filter(function () { - return $.contains($errordom, this) || $.inArray(this, $errordom); + var sdom = dom.split(','); + var exclude = ":not(#oe_manipulators):not(#website-top-navbar)"; + dom = ""; + _.each(sdom, function (val) { + val = val.replace(/^\s+|\s+$/g, ''); + dom += "body > " + exclude + " " + val + ", "; + val = val.split(" "); + dom += "body > "+ val.shift() + exclude + val.join(" ") + ", "; }); + dom = dom.replace(/,\s*$/g, ''); + return $(dom); }, start: function() { var self = this; diff --git a/addons/website/static/src/xml/website.snippets.xml b/addons/website/static/src/xml/website.snippets.xml index 3b2cf2ea383..8d471479570 100644 --- a/addons/website/static/src/xml/website.snippets.xml +++ b/addons/website/static/src/xml/website.snippets.xml @@ -99,7 +99,7 @@ <div class='oe_snippet_thumbnail oe_label'>Darken</div> </div> - <div t-name="website.snippets.well" data-snippet-id='well' data-category='content' data-selector-siblings='div, p, h1, h2, h3, blockquote'> + <div t-name="website.snippets.well" data-snippet-id='well' data-category='content' data-selector-siblings='p, h1, h2, h3, blockquote'> <div class='oe_snippet_thumbnail oe_label'>Well</div> <div class="oe_snippet_body well"> Manage your sales funnel with no effort with OpenERP CRM. Attract @@ -108,7 +108,7 @@ </div> </div> - <div t-name="website.snippets.quote" data-snippet-id='quote' data-category='content' data-selector-siblings='div, p, h1, h2, h3, blockquote'> + <div t-name="website.snippets.quote" data-snippet-id='quote' data-category='content' data-selector-siblings='p, h1, h2, h3, blockquote'> <div class='oe_snippet_thumbnail oe_label'>Quote</div> <blockquote class="oe_snippet_body"> <p> @@ -119,7 +119,7 @@ </blockquote> </div> - <div t-name="website.snippets.panel" data-snippet-id='panel' data-category='content' data-selector-siblings='div, p, h1, h2, h3, blockquote'> + <div t-name="website.snippets.panel" data-snippet-id='panel' data-category='content' data-selector-siblings='p, h1, h2, h3, blockquote'> <div class='oe_snippet_thumbnail oe_label'>Panel</div> <div class="oe_snippet_body panel panel-default"> <div class="panel-heading"> |
