[xmosaicframe] small refactoring: use an alias for root.querySelector

authorSamuel Trégouët <samuel.tregouet@logilab.fr>
changeset5ee6b9c8d679
branchdefault
phasepublic
hiddenno
parent revision#a9b154589e5a tell jshint ``$`` is a global variable
child revision#a2ea06e8687d [xmosaicframe] add a button to remove a frame (closes #289628)
files modified by this revision
components/xmosaicframe/xmosaicframe.es6
# HG changeset patch
# User Samuel Trégouët <samuel.tregouet@logilab.fr>
# Date 1427453145 -3600
# Fri Mar 27 11:45:45 2015 +0100
# Node ID 5ee6b9c8d679519de923c33c9191bde2d810efb2
# Parent a9b154589e5a1f2db0942cfaa5ddebe22b3c4c9b
[xmosaicframe] small refactoring: use an alias for root.querySelector

diff --git a/components/xmosaicframe/xmosaicframe.es6 b/components/xmosaicframe/xmosaicframe.es6
@@ -8,20 +8,21 @@
1          let template = ownerDocument.querySelector('#x-mosaic-frame-template');
2          let clone = document.importNode(template.content, true);
3          let root = host.createShadowRoot();
4          let registry = require('registry');
5          root.appendChild(clone);
6 -        root.querySelector('#edit').addEventListener('click', function(e) {
7 -            root.querySelector('#panel').style.display = 'none';
8 -            root.querySelector('form').style.display = 'block';
9 +        var qs = root.querySelector.bind(root);
10 +        qs('#edit').addEventListener('click', function(e) {
11 +            qs('#panel').style.display = 'none';
12 +            qs('form').style.display = 'block';
13          });
14 -        root.querySelector('form').addEventListener('submit', function(e) {
15 -            host.dataset.source = root.querySelector('input[name="source"]:checked').value;
16 -            host.dataset.baseurl = root.querySelector('input[name="baseurl"]').value;
17 -            host.dataset.query = root.querySelector('textarea[name="query"]').value;
18 -            root.querySelector('#panel').style.display = 'block';
19 -            root.querySelector('form').style.display = 'none';
20 +        qs('form').addEventListener('submit', function(e) {
21 +            host.dataset.source = qs('input[name="source"]:checked').value;
22 +            host.dataset.baseurl = qs('input[name="baseurl"]').value;
23 +            host.dataset.query = qs('textarea[name="query"]').value;
24 +            qs('#panel').style.display = 'block';
25 +            qs('form').style.display = 'none';
26              queryUpdated(host, ownerDocument, registry);
27              e.preventDefault();
28          });
29      }
30