diff --git a/src/Browser.php b/src/Browser.php index f32ac2dbf..f956f882b 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -518,6 +518,20 @@ public function elsewhere($selector, Closure $callback) return $this; } + /** + * Execute a Closure outside of the current browser scope when the selector is available. + * + * @param string $selector + * @param \Closure $callback + * @return $this + */ + public function elsewhereWhenAvailable($selector, Closure $callback) + { + return $this->elsewhere('', function ($browser) use ($selector, $callback) { + $this->whenAvailable($selector, $callback); + }); + } + /** * Set the current component state. *