{"action":"created","comment":{"url":"https://api.github.com/repos/addless/has-selector.js/pulls/comments/72978389","id":72978389,"diff_hunk":"@@ -82,39 +98,50 @@\n         case \"}\":\n             if (inAtBlck) inAtBlck--;\n             if (inStyles) inStyles--;\n-            i = f.index + 1;\n+            outerBgn = f.index + 1;\n             break;\n \n         case \",\":\n-            if (!inParens && !inStyles && !inAtSlct && !inAtBlck) i = f.index + 1;\n+            if (!inStyles && !inAtSlct && !inAtBlck) outerBgn = f.index + 1;\n+            break;\n+\n+        case \"+\":\n+        case \"~\":\n+        case \" \":\n+        case \">\":\n+            if (inPseudo) inPseudo--;\n+            break;\n+\n+        case \":\":\n+            if (!inPrnths && !inStyles && !inAtSlct && !inAtBlck && !inPseudo) outerEnd = f.index;\n+            if (!inPrnths && !inStyles && !inAtSlct && !inAtBlck && !inPseudo) inPseudo++;\n             break;\n \n-        case \":has\":\n-            h = f.index;\n-            inHasDec++;\n+        case \"has\":\n+            if (inPseudo) inHasDec = inPrnths + 1;\n+            if (inPseudo) innerBgn = f.index - 1;\n         }\n \n         // This function creates a unique alias, replaces the :has declaration with it,\n         // and records the :has declaration's outer and inner element selectors.\n         // Without it, it's content would be nested within  switch statement.\n-        function addAlias() {\n+        function addHasAlias() {\n             var A = \"abcdefghijklmnopqrstuvwxyz\"; // valid characters for the beginning of a class name\n             var n = Math.random() * A.length | 0; // index determining which of the above characters to use\n-            var c = A[n] + basis.toString(36);    // unique class name\n-            var L = 5;                            // the number of characters in the string \":has\"\n-\n-            basis += 1;\n-            alias.push(c);\n-            r.lastIndex = h;\n-            foundAny = true;\n-            outer.push(t.slice(i, h));\n-            inner.push(t.slice(h + L, f.index));\n-            t = t.slice(0, h) + \".\" + c + t.slice(f.index + 1);\n+            var a = A[n] + unique.toString(36);   // unique class name\n+            var L = 5;                            // the length of the string \":has\"\n+\n+            unique += 1;\n+            alias.push(a);\n+            r.lastIndex = innerBgn;\n+            outer.push(styleTxt.slice(outerBgn, outerEnd));\n+            inner.push(styleTxt.slice(innerBgn + L, innerEnd - 1));\n+            styleTxt = styleTxt.slice(0, innerBgn) + \".\" + a + styleTxt.slice(innerEnd);\n         }\n \n-        if (foundAny) {\n-            s.appendChild(document.createTextNode(t));\n-            link.parentNode.replaceChild(s, link);\n+        if (xhr.responseText !== styleTxt) {\n+            newStyle.appendChild(document.createTextNode(styleTxt));\n+            oldElem.parentNode.replaceChild(newStyle, oldElem);","path":"has-selector.js","position":195,"original_position":195,"commit_id":"167b2f69f893154c59f5c000b414c38bd4566b63","original_commit_id":"167b2f69f893154c59f5c000b414c38bd4566b63","user":{"login":"tinisi","id":4769997,"avatar_url":"https://avatars.githubusercontent.com/u/4769997?v=3","gravatar_id":"","url":"https://api.github.com/users/tinisi","html_url":"https://github.com/tinisi","followers_url":"https://api.github.com/users/tinisi/followers","following_url":"https://api.github.com/users/tinisi/following{/other_user}","gists_url":"https://api.github.com/users/tinisi/gists{/gist_id}","starred_url":"https://api.github.com/users/tinisi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinisi/subscriptions","organizations_url":"https://api.github.com/users/tinisi/orgs","repos_url":"https://api.github.com/users/tinisi/repos","events_url":"https://api.github.com/users/tinisi/events{/privacy}","received_events_url":"https://api.github.com/users/tinisi/received_events","type":"User","site_admin":false},"body":"A big YES to these two lines, much easier to understand than the previous revision.","created_at":"2016-08-01T13:36:26Z","updated_at":"2016-08-01T13:36:26Z","html_url":"https://github.com/addless/has-selector.js/pull/4#discussion_r72978389","pull_request_url":"https://api.github.com/repos/addless/has-selector.js/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/addless/has-selector.js/pulls/comments/72978389"},"html":{"href":"https://github.com/addless/has-selector.js/pull/4#discussion_r72978389"},"pull_request":{"href":"https://api.github.com/repos/addless/has-selector.js/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/addless/has-selector.js/pulls/4","id":79551854,"html_url":"https://github.com/addless/has-selector.js/pull/4","diff_url":"https://github.com/addless/has-selector.js/pull/4.diff","patch_url":"https://github.com/addless/has-selector.js/pull/4.patch","issue_url":"https://api.github.com/repos/addless/has-selector.js/issues/4","number":4,"state":"open","locked":false,"title":"NGDC 2198","user":{"login":"janderson99","id":5655348,"avatar_url":"https://avatars.githubusercontent.com/u/5655348?v=3","gravatar_id":"","url":"https://api.github.com/users/janderson99","html_url":"https://github.com/janderson99","followers_url":"https://api.github.com/users/janderson99/followers","following_url":"https://api.github.com/users/janderson99/following{/other_user}","gists_url":"https://api.github.com/users/janderson99/gists{/gist_id}","starred_url":"https://api.github.com/users/janderson99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janderson99/subscriptions","organizations_url":"https://api.github.com/users/janderson99/orgs","repos_url":"https://api.github.com/users/janderson99/repos","events_url":"https://api.github.com/users/janderson99/events{/privacy}","received_events_url":"https://api.github.com/users/janderson99/received_events","type":"User","site_admin":false},"body":"NGDC-2198 UX: \"has-selector.js\" Should Render After CSS Load, Block\nDuring Load","created_at":"2016-08-01T11:13:13Z","updated_at":"2016-08-01T13:36:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a53d9819a68fe5345fa6ff85364ac755aacee83","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/addless/has-selector.js/pulls/4/commits","review_comments_url":"https://api.github.com/repos/addless/has-selector.js/pulls/4/comments","review_comment_url":"https://api.github.com/repos/addless/has-selector.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/addless/has-selector.js/issues/4/comments","statuses_url":"https://api.github.com/repos/addless/has-selector.js/statuses/167b2f69f893154c59f5c000b414c38bd4566b63","head":{"label":"addless:NGDC-2198","ref":"NGDC-2198","sha":"167b2f69f893154c59f5c000b414c38bd4566b63","user":{"login":"addless","id":19709856,"avatar_url":"https://avatars.githubusercontent.com/u/19709856?v=3","gravatar_id":"","url":"https://api.github.com/users/addless","html_url":"https://github.com/addless","followers_url":"https://api.github.com/users/addless/followers","following_url":"https://api.github.com/users/addless/following{/other_user}","gists_url":"https://api.github.com/users/addless/gists{/gist_id}","starred_url":"https://api.github.com/users/addless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addless/subscriptions","organizations_url":"https://api.github.com/users/addless/orgs","repos_url":"https://api.github.com/users/addless/repos","events_url":"https://api.github.com/users/addless/events{/privacy}","received_events_url":"https://api.github.com/users/addless/received_events","type":"Organization","site_admin":false},"repo":{"id":61038593,"name":"has-selector.js","full_name":"addless/has-selector.js","owner":{"login":"addless","id":19709856,"avatar_url":"https://avatars.githubusercontent.com/u/19709856?v=3","gravatar_id":"","url":"https://api.github.com/users/addless","html_url":"https://github.com/addless","followers_url":"https://api.github.com/users/addless/followers","following_url":"https://api.github.com/users/addless/following{/other_user}","gists_url":"https://api.github.com/users/addless/gists{/gist_id}","starred_url":"https://api.github.com/users/addless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addless/subscriptions","organizations_url":"https://api.github.com/users/addless/orgs","repos_url":"https://api.github.com/users/addless/repos","events_url":"https://api.github.com/users/addless/events{/privacy}","received_events_url":"https://api.github.com/users/addless/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/addless/has-selector.js","description":"Polyfill for the CSS :has selector. Nothing more. Nothing less.","fork":false,"url":"https://api.github.com/repos/addless/has-selector.js","forks_url":"https://api.github.com/repos/addless/has-selector.js/forks","keys_url":"https://api.github.com/repos/addless/has-selector.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/addless/has-selector.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/addless/has-selector.js/teams","hooks_url":"https://api.github.com/repos/addless/has-selector.js/hooks","issue_events_url":"https://api.github.com/repos/addless/has-selector.js/issues/events{/number}","events_url":"https://api.github.com/repos/addless/has-selector.js/events","assignees_url":"https://api.github.com/repos/addless/has-selector.js/assignees{/user}","branches_url":"https://api.github.com/repos/addless/has-selector.js/branches{/branch}","tags_url":"https://api.github.com/repos/addless/has-selector.js/tags","blobs_url":"https://api.github.com/repos/addless/has-selector.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/addless/has-selector.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/addless/has-selector.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/addless/has-selector.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/addless/has-selector.js/statuses/{sha}","languages_url":"https://api.github.com/repos/addless/has-selector.js/languages","stargazers_url":"https://api.github.com/repos/addless/has-selector.js/stargazers","contributors_url":"https://api.github.com/repos/addless/has-selector.js/contributors","subscribers_url":"https://api.github.com/repos/addless/has-selector.js/subscribers","subscription_url":"https://api.github.com/repos/addless/has-selector.js/subscription","commits_url":"https://api.github.com/repos/addless/has-selector.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/addless/has-selector.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/addless/has-selector.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/addless/has-selector.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/addless/has-selector.js/contents/{+path}","compare_url":"https://api.github.com/repos/addless/has-selector.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/addless/has-selector.js/merges","archive_url":"https://api.github.com/repos/addless/has-selector.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/addless/has-selector.js/downloads","issues_url":"https://api.github.com/repos/addless/has-selector.js/issues{/number}","pulls_url":"https://api.github.com/repos/addless/has-selector.js/pulls{/number}","milestones_url":"https://api.github.com/repos/addless/has-selector.js/milestones{/number}","notifications_url":"https://api.github.com/repos/addless/has-selector.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/addless/has-selector.js/labels{/name}","releases_url":"https://api.github.com/repos/addless/has-selector.js/releases{/id}","deployments_url":"https://api.github.com/repos/addless/has-selector.js/deployments","created_at":"2016-06-13T13:28:05Z","updated_at":"2016-06-13T13:50:00Z","pushed_at":"2016-08-01T11:26:50Z","git_url":"git://github.com/addless/has-selector.js.git","ssh_url":"git@github.com:addless/has-selector.js.git","clone_url":"https://github.com/addless/has-selector.js.git","svn_url":"https://github.com/addless/has-selector.js","homepage":null,"size":8,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"addless:master","ref":"master","sha":"8468e527f7aa58abe20a349d4762045c9d96b9fd","user":{"login":"addless","id":19709856,"avatar_url":"https://avatars.githubusercontent.com/u/19709856?v=3","gravatar_id":"","url":"https://api.github.com/users/addless","html_url":"https://github.com/addless","followers_url":"https://api.github.com/users/addless/followers","following_url":"https://api.github.com/users/addless/following{/other_user}","gists_url":"https://api.github.com/users/addless/gists{/gist_id}","starred_url":"https://api.github.com/users/addless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addless/subscriptions","organizations_url":"https://api.github.com/users/addless/orgs","repos_url":"https://api.github.com/users/addless/repos","events_url":"https://api.github.com/users/addless/events{/privacy}","received_events_url":"https://api.github.com/users/addless/received_events","type":"Organization","site_admin":false},"repo":{"id":61038593,"name":"has-selector.js","full_name":"addless/has-selector.js","owner":{"login":"addless","id":19709856,"avatar_url":"https://avatars.githubusercontent.com/u/19709856?v=3","gravatar_id":"","url":"https://api.github.com/users/addless","html_url":"https://github.com/addless","followers_url":"https://api.github.com/users/addless/followers","following_url":"https://api.github.com/users/addless/following{/other_user}","gists_url":"https://api.github.com/users/addless/gists{/gist_id}","starred_url":"https://api.github.com/users/addless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addless/subscriptions","organizations_url":"https://api.github.com/users/addless/orgs","repos_url":"https://api.github.com/users/addless/repos","events_url":"https://api.github.com/users/addless/events{/privacy}","received_events_url":"https://api.github.com/users/addless/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/addless/has-selector.js","description":"Polyfill for the CSS :has selector. Nothing more. Nothing less.","fork":false,"url":"https://api.github.com/repos/addless/has-selector.js","forks_url":"https://api.github.com/repos/addless/has-selector.js/forks","keys_url":"https://api.github.com/repos/addless/has-selector.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/addless/has-selector.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/addless/has-selector.js/teams","hooks_url":"https://api.github.com/repos/addless/has-selector.js/hooks","issue_events_url":"https://api.github.com/repos/addless/has-selector.js/issues/events{/number}","events_url":"https://api.github.com/repos/addless/has-selector.js/events","assignees_url":"https://api.github.com/repos/addless/has-selector.js/assignees{/user}","branches_url":"https://api.github.com/repos/addless/has-selector.js/branches{/branch}","tags_url":"https://api.github.com/repos/addless/has-selector.js/tags","blobs_url":"https://api.github.com/repos/addless/has-selector.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/addless/has-selector.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/addless/has-selector.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/addless/has-selector.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/addless/has-selector.js/statuses/{sha}","languages_url":"https://api.github.com/repos/addless/has-selector.js/languages","stargazers_url":"https://api.github.com/repos/addless/has-selector.js/stargazers","contributors_url":"https://api.github.com/repos/addless/has-selector.js/contributors","subscribers_url":"https://api.github.com/repos/addless/has-selector.js/subscribers","subscription_url":"https://api.github.com/repos/addless/has-selector.js/subscription","commits_url":"https://api.github.com/repos/addless/has-selector.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/addless/has-selector.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/addless/has-selector.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/addless/has-selector.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/addless/has-selector.js/contents/{+path}","compare_url":"https://api.github.com/repos/addless/has-selector.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/addless/has-selector.js/merges","archive_url":"https://api.github.com/repos/addless/has-selector.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/addless/has-selector.js/downloads","issues_url":"https://api.github.com/repos/addless/has-selector.js/issues{/number}","pulls_url":"https://api.github.com/repos/addless/has-selector.js/pulls{/number}","milestones_url":"https://api.github.com/repos/addless/has-selector.js/milestones{/number}","notifications_url":"https://api.github.com/repos/addless/has-selector.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/addless/has-selector.js/labels{/name}","releases_url":"https://api.github.com/repos/addless/has-selector.js/releases{/id}","deployments_url":"https://api.github.com/repos/addless/has-selector.js/deployments","created_at":"2016-06-13T13:28:05Z","updated_at":"2016-06-13T13:50:00Z","pushed_at":"2016-08-01T11:26:50Z","git_url":"git://github.com/addless/has-selector.js.git","ssh_url":"git@github.com:addless/has-selector.js.git","clone_url":"https://github.com/addless/has-selector.js.git","svn_url":"https://github.com/addless/has-selector.js","homepage":null,"size":8,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/addless/has-selector.js/pulls/4"},"html":{"href":"https://github.com/addless/has-selector.js/pull/4"},"issue":{"href":"https://api.github.com/repos/addless/has-selector.js/issues/4"},"comments":{"href":"https://api.github.com/repos/addless/has-selector.js/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/addless/has-selector.js/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/addless/has-selector.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/addless/has-selector.js/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/addless/has-selector.js/statuses/167b2f69f893154c59f5c000b414c38bd4566b63"}}}}
{"actor":{"display_login":"tinisi"}}