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

authorSamuel Trégouët <samuel.tregouet@logilab.fr>
changeset31c12b7e2c6c
branchdefault
phasedraft
hiddenyes
parent revision#bd708f0880af tell jshint ``$`` is a global variable
child revision#81f2912eef8e [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 31c12b7e2c6cd491a79297477c7656d4c735d326
# Parent bd708f0880af3a12eabaf1b8e0ff0c9d2742f241
[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