{"action":"created","issue":{"url":"https://api.github.com/repos/watir/watir-webdriver/issues/392","labels_url":"https://api.github.com/repos/watir/watir-webdriver/issues/392/labels{/name}","comments_url":"https://api.github.com/repos/watir/watir-webdriver/issues/392/comments","events_url":"https://api.github.com/repos/watir/watir-webdriver/issues/392/events","html_url":"https://github.com/watir/watir-webdriver/pull/392","id":125910769,"number":392,"title":"Refactoring of locators","user":{"login":"p0deje","id":665846,"avatar_url":"https://avatars.githubusercontent.com/u/665846?v=3","gravatar_id":"","url":"https://api.github.com/users/p0deje","html_url":"https://github.com/p0deje","followers_url":"https://api.github.com/users/p0deje/followers","following_url":"https://api.github.com/users/p0deje/following{/other_user}","gists_url":"https://api.github.com/users/p0deje/gists{/gist_id}","starred_url":"https://api.github.com/users/p0deje/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p0deje/subscriptions","organizations_url":"https://api.github.com/users/p0deje/orgs","repos_url":"https://api.github.com/users/p0deje/repos","events_url":"https://api.github.com/users/p0deje/events{/privacy}","received_events_url":"https://api.github.com/users/p0deje/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-11T10:05:19Z","updated_at":"2016-01-15T15:36:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/watir/watir-webdriver/pulls/392","html_url":"https://github.com/watir/watir-webdriver/pull/392","diff_url":"https://github.com/watir/watir-webdriver/pull/392.diff","patch_url":"https://github.com/watir/watir-webdriver/pull/392.patch"},"body":"The following pull request refactors huge `ElementLocator` and all its children to a more atomic separate classes. The end result is far for being perfect, but even in this shape it is more clear and readable:\r\n\r\n1. Split element locator to locator, which is injected with selector builder and element validator classes.\r\n2. Separate XPath and CSS selector building.\r\n3. Namespace new classes under element class.\r\n4. Dynamically lookup new classes so that any element can override default behavior (As a side effect, I had to introduce `Cell` and `Row` classes).\r\n\r\nThe changes don't modify locator logic, only reorganizes it so that responsibility are more clear and follow-up refactoring can be done.\r\n\r\nI also made `Element#element_class` purely dynamic since in all cases it can be calculated from element collection class name.\r\n\r\nThis pull request also removes the long deprecated case when `textarea` can be located with `text_field`. Related watirspec changes will be pushed once it's merged.\r\n\r\n@titusfortner Please take a look. If you are fine with the changes, I'm going to merge them.\r\n\r\nP.S. That's going to be a subject of my talk at Bazaar 2016 - the way watir-webdriver locates elements."},"comment":{"url":"https://api.github.com/repos/watir/watir-webdriver/issues/comments/171993304","html_url":"https://github.com/watir/watir-webdriver/pull/392#issuecomment-171993304","issue_url":"https://api.github.com/repos/watir/watir-webdriver/issues/392","id":171993304,"user":{"login":"titusfortner","id":777185,"avatar_url":"https://avatars.githubusercontent.com/u/777185?v=3","gravatar_id":"","url":"https://api.github.com/users/titusfortner","html_url":"https://github.com/titusfortner","followers_url":"https://api.github.com/users/titusfortner/followers","following_url":"https://api.github.com/users/titusfortner/following{/other_user}","gists_url":"https://api.github.com/users/titusfortner/gists{/gist_id}","starred_url":"https://api.github.com/users/titusfortner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titusfortner/subscriptions","organizations_url":"https://api.github.com/users/titusfortner/orgs","repos_url":"https://api.github.com/users/titusfortner/repos","events_url":"https://api.github.com/users/titusfortner/events{/privacy}","received_events_url":"https://api.github.com/users/titusfortner/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T15:36:13Z","updated_at":"2016-01-15T15:36:13Z","body":"Oh and before I get too far nit-picking this... Thanks for this PR. This reorganization was sorely needed. I think this was the most confusing part of the Watir codebase, and I'm excited that we can get it more accessible."}}