Change clientutils to be able to set a global scope
Showing
1 changed file
with
3 additions
and
3 deletions
... | @@ -57,7 +57,7 @@ | ... | @@ -57,7 +57,7 @@ |
57 | 57 | ||
58 | // public members | 58 | // public members |
59 | this.options = options || {}; | 59 | this.options = options || {}; |
60 | 60 | this.options.scope = this.options.scope || document; | |
61 | /** | 61 | /** |
62 | * Clicks on the DOM element behind the provided selector. | 62 | * Clicks on the DOM element behind the provided selector. |
63 | * | 63 | * |
... | @@ -243,7 +243,7 @@ | ... | @@ -243,7 +243,7 @@ |
243 | * @return NodeList|undefined | 243 | * @return NodeList|undefined |
244 | */ | 244 | */ |
245 | this.findAll = function findAll(selector, scope) { | 245 | this.findAll = function findAll(selector, scope) { |
246 | scope = scope || document; | 246 | scope = scope || this.options.scope; |
247 | try { | 247 | try { |
248 | var pSelector = this.processSelector(selector); | 248 | var pSelector = this.processSelector(selector); |
249 | if (pSelector.type === 'xpath') { | 249 | if (pSelector.type === 'xpath') { |
... | @@ -264,7 +264,7 @@ | ... | @@ -264,7 +264,7 @@ |
264 | * @return HTMLElement|undefined | 264 | * @return HTMLElement|undefined |
265 | */ | 265 | */ |
266 | this.findOne = function findOne(selector, scope) { | 266 | this.findOne = function findOne(selector, scope) { |
267 | scope = scope || document; | 267 | scope = scope || this.options.scope; |
268 | try { | 268 | try { |
269 | var pSelector = this.processSelector(selector); | 269 | var pSelector = this.processSelector(selector); |
270 | if (pSelector.type === 'xpath') { | 270 | if (pSelector.type === 'xpath') { | ... | ... |
-
Please register or sign in to post a comment