From 96aad743ea30d805a0f0a9723ab45da8e108b70a Mon Sep 17 00:00:00 2001 From: sam marshall Date: Tue, 19 Oct 2021 13:47:20 +0100 Subject: [PATCH] MDL-72849 tool_behat: Use of xpath name() not compatible with Firefox The xpath name() function returns upper-case e.g. 'IMG' in Firefox and lower-case e.g. 'img' in Chrome. --- lib/behat/classes/exact_named_selector.php | 2 +- lib/behat/classes/partial_named_selector.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/behat/classes/exact_named_selector.php b/lib/behat/classes/exact_named_selector.php index e178daed7bd..0a74c0e08a6 100644 --- a/lib/behat/classes/exact_named_selector.php +++ b/lib/behat/classes/exact_named_selector.php @@ -39,7 +39,7 @@ class behat_exact_named_selector extends \Behat\Mink\Selector\ExactNamedSelector * Creates selector instance. */ public function __construct() { - $this->registerReplacement('%iconMatch%', "(contains(concat(' ', @class, ' '), ' icon ') or name() = 'img')"); + $this->registerReplacement('%iconMatch%', "(contains(concat(' ', @class, ' '), ' icon ') or self::img)"); $this->registerReplacement('%imgAltMatch%', './/*[%iconMatch% and (%altMatch% or %titleMatch%)]'); parent::__construct(); } diff --git a/lib/behat/classes/partial_named_selector.php b/lib/behat/classes/partial_named_selector.php index 7965f49f5f5..b65f1283574 100644 --- a/lib/behat/classes/partial_named_selector.php +++ b/lib/behat/classes/partial_named_selector.php @@ -52,7 +52,7 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele $this->registerReplacement($from, implode(' or ', $tos)); } - $this->registerReplacement('%iconMatch%', "(contains(concat(' ', @class, ' '), ' icon ') or name() = 'img')"); + $this->registerReplacement('%iconMatch%', "(contains(concat(' ', @class, ' '), ' icon ') or self::img)"); $this->registerReplacement('%imgAltMatch%', './/*[%iconMatch% and (%altMatch% or %titleMatch%)]'); parent::__construct(); }