Skip to content

Commit

Permalink
Use htmlFor on IE.
Browse files Browse the repository at this point in the history
[#317 state:resolved]
  • Loading branch information
djanowski committed Apr 15, 2010
1 parent 06bb72d commit 1979a7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/webrat/selenium/location_strategy_javascript/label.js
Expand Up @@ -21,7 +21,7 @@ var candidateLabels = $A(allLabels).select(function(candidateLabel){
});

if (candidateLabels.length == 0) {
return null;
return null;
}

//reverse length sort
Expand All @@ -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]
Expand Down

4 comments on commit 1979a7f

@noahd1
Copy link
Collaborator

@noahd1 noahd1 commented on 1979a7f Apr 21, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks the webrat selenium integration tests in FF/Safari. I committed a fix that tries to maintain the IE compatibility that you provided without breaking FF/Safari. It seems to work now in FF/Safari, but unfortunately I don't have a IE/Selenium environment to see if it works in IE as well. Can you try it out and let me know?

@djanowski
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the IE/Selenium env either but I confirmed that you can access .attributes['for'].nodeValue.
I'm still interested in how it broke Firefox. Did you simply run rake spec:integration?

@noahd1
Copy link
Collaborator

@noahd1 noahd1 commented on 1979a7f Apr 21, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what I ran. It runs in Safari by default. To have it use Firefox, I changed the setting in test_helper.rb to use "*firefox" for the config.selenium_browser_key ...

It's possible that it was only an intermittent failure, but it was fairly consistent.

@djanowski
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. I was just asking to see if I missed something when a ran the build before applying the fix.
Thanks!

Please sign in to comment.