From 1979a7fc7f9a2f951d1bb37e77235b12bf452001 Mon Sep 17 00:00:00 2001 From: Damian Janowski Date: Thu, 15 Apr 2010 15:40:03 -0300 Subject: [PATCH] Use `htmlFor` on IE. [#317 state:resolved] --- lib/webrat/selenium/location_strategy_javascript/label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/webrat/selenium/location_strategy_javascript/label.js b/lib/webrat/selenium/location_strategy_javascript/label.js index dd13744..b5dc731 100644 --- a/lib/webrat/selenium/location_strategy_javascript/label.js +++ b/lib/webrat/selenium/location_strategy_javascript/label.js @@ -21,7 +21,7 @@ var candidateLabels = $A(allLabels).select(function(candidateLabel){ }); if (candidateLabels.length == 0) { - return null; + return null; } //reverse length sort @@ -30,7 +30,7 @@ candidateLabels = candidateLabels.sortBy(function(s) { }); var locatedLabel = candidateLabels.first(); -var labelFor = locatedLabel.getAttribute('for'); +var labelFor = locatedLabel.getAttribute('for') || locatedLabel.htmlFor; if ((labelFor == null) && (locatedLabel.hasChildNodes())) { return locatedLabel.getElementsByTagName('button')[0]