Commit c3db0ced c3db0ced55156af07575dd6ddb3a6217ca26aca1 by Nicolas Perriault

clientutils: use of findAll anywhere applicable

1 parent 392556ba
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
156 */ 156 */
157 this.exists = function exists(selector) { 157 this.exists = function exists(selector) {
158 try { 158 try {
159 return document.querySelectorAll(selector).length > 0; 159 return this.findAll(selector).length > 0;
160 } catch (e) { 160 } catch (e) {
161 return false; 161 return false;
162 } 162 }
...@@ -195,7 +195,7 @@ ...@@ -195,7 +195,7 @@
195 if (!(form instanceof HTMLElement) || typeof form === "string") { 195 if (!(form instanceof HTMLElement) || typeof form === "string") {
196 __utils__.log("attempting to fetch form element from selector: '" + form + "'", "info"); 196 __utils__.log("attempting to fetch form element from selector: '" + form + "'", "info");
197 try { 197 try {
198 form = document.querySelector(form); 198 form = this.findOne(form);
199 } catch (e) { 199 } catch (e) {
200 if (e.name === "SYNTAX_ERR") { 200 if (e.name === "SYNTAX_ERR") {
201 out.errors.push("invalid form selector provided: '" + form + "'"); 201 out.errors.push("invalid form selector provided: '" + form + "'");
...@@ -328,7 +328,7 @@ ...@@ -328,7 +328,7 @@
328 */ 328 */
329 this.getElementBounds = function getElementBounds(selector) { 329 this.getElementBounds = function getElementBounds(selector) {
330 try { 330 try {
331 var clipRect = document.querySelector(selector).getBoundingClientRect(); 331 var clipRect = this.findOne(selector).getBoundingClientRect();
332 return { 332 return {
333 top: clipRect.top, 333 top: clipRect.top,
334 left: clipRect.left, 334 left: clipRect.left,
...@@ -477,7 +477,7 @@ ...@@ -477,7 +477,7 @@
477 */ 477 */
478 this.visible = function visible(selector) { 478 this.visible = function visible(selector) {
479 try { 479 try {
480 var el = document.querySelector(selector); 480 var el = this.findOne(selector);
481 return el && el.style.visibility !== 'hidden' && el.offsetHeight > 0 && el.offsetWidth > 0; 481 return el && el.style.visibility !== 'hidden' && el.offsetHeight > 0 && el.offsetWidth > 0;
482 } catch (e) { 482 } catch (e) {
483 return false; 483 return false;
......