{"action":"created","issue":{"url":"https://api.github.com/repos/radkovo/jStyleParser/issues/17","labels_url":"https://api.github.com/repos/radkovo/jStyleParser/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/radkovo/jStyleParser/issues/17/comments","events_url":"https://api.github.com/repos/radkovo/jStyleParser/issues/17/events","html_url":"https://github.com/radkovo/jStyleParser/issues/17","id":59327849,"number":17,"title":"Detecting invalidation cases efficiently","user":{"login":"hrj","id":345879,"avatar_url":"https://avatars.githubusercontent.com/u/345879?v=3","gravatar_id":"","url":"https://api.github.com/users/hrj","html_url":"https://github.com/hrj","followers_url":"https://api.github.com/users/hrj/followers","following_url":"https://api.github.com/users/hrj/following{/other_user}","gists_url":"https://api.github.com/users/hrj/gists{/gist_id}","starred_url":"https://api.github.com/users/hrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrj/subscriptions","organizations_url":"https://api.github.com/users/hrj/orgs","repos_url":"https://api.github.com/users/hrj/repos","events_url":"https://api.github.com/users/hrj/events{/privacy}","received_events_url":"https://api.github.com/users/hrj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-02-28T06:08:39Z","updated_at":"2015-07-06T20:46:13Z","closed_at":null,"body":"### Use-case\r\nIn the browser, when the mouse is hovered over an element, we need to find out whether that element has a hover style and then invalidate the layout+renderer accordingly.\r\n\r\n### Question\r\nIs there a good / optimal way to do this? If not, can it be added?\r\n\r\n### Suggestion\r\nOne way could be: the analyser has an API that returns a list of applicable rules for an element. The caller can then walk the rules to see if any rule depends on a specified pseudo-element and hence requires invalidation."},"comment":{"url":"https://api.github.com/repos/radkovo/jStyleParser/issues/comments/118993490","html_url":"https://github.com/radkovo/jStyleParser/issues/17#issuecomment-118993490","issue_url":"https://api.github.com/repos/radkovo/jStyleParser/issues/17","id":118993490,"user":{"login":"hrj","id":345879,"avatar_url":"https://avatars.githubusercontent.com/u/345879?v=3","gravatar_id":"","url":"https://api.github.com/users/hrj","html_url":"https://github.com/hrj","followers_url":"https://api.github.com/users/hrj/followers","following_url":"https://api.github.com/users/hrj/following{/other_user}","gists_url":"https://api.github.com/users/hrj/gists{/gist_id}","starred_url":"https://api.github.com/users/hrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrj/subscriptions","organizations_url":"https://api.github.com/users/hrj/orgs","repos_url":"https://api.github.com/users/hrj/repos","events_url":"https://api.github.com/users/hrj/events{/privacy}","received_events_url":"https://api.github.com/users/hrj/received_events","type":"User","site_admin":false},"created_at":"2015-07-06T20:46:13Z","updated_at":"2015-07-06T20:46:13Z","body":"@radkovo Ignore my previous comment. It was rather pointless. The API you have proposed is fine; except the memory requirement would be high (as you rightly pointed out). Perhaps, the ancestor data can be cached for only a part of the DOM tree (for example, in the case of `:hover`, the part underneath the current cursor position). Even then, there will be a small overhead of reserving a pointer in the element, and the cost of ensuring it is invalidated whenever the DOM changes.\r\n\r\nIn the first cut, I will try to implement a non-caching approach (the one I proposed initially). I have implemented the `getElementApplicableRules` today. I am working on the `hasPseudoStyle` API now."}}