{"action":"created","comment":{"url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments/30307954","id":30307954,"diff_hunk":"@@ -0,0 +1,142 @@\n+/* \n+Copyright (c) 2015, Yahoo Inc. All rights reserved.\n+Copyrights licensed under the New BSD License.\n+See the accompanying LICENSE file for terms.\n+\n+Authors: Nera Liu <neraliu@yahoo-inc.com>\n+         Albert Yu <albertyu@yahoo-inc.com>\n+         Adonis Fung <adon@yahoo-inc.com>\n+*/\n+(function () {\n+\"use strict\";\n+\n+var cssParser = require(\"./css-parser/css-parser.js\");\n+\n+/////////////////////////////////////////////////////\n+//\n+// @module CSSParserUtils\n+// \n+/////////////////////////////////////////////////////\n+var CSSParserUtils = {};\n+\n+/*\n+'&#0*45;?|&#[xX]0*2[dD];?'                              // minus & dash\n+'&#0*92;?|&#[xX]0*5[cC];?|&bsol;'\t\t \t// \\\n+'&#0*95;?|&#[xX]0*5[fF];?|&lowbar;|&UnderBar;'\t\t// _\n+'&#0*58;?|&#[xX]0*3[aA];?|&colon;'      \t\t// colon\n+'&#0*59;?|&#[xX]0*3[bB];?|&semi;'       \t\t// semicolon\n+'&#0*40;?|&#[xX]0*28;?|&lpar;'          \t\t// (\n+'&#0*41;?|&#[xX]0*29;?|&rpar;'          \t\t// )\n+'&#0*34;?|&#[xX]0*22;?|&quot;|&QUOT;'\t\t\t// \"\n+'&#0*39;?|&#[xX]0*27;?|&apos;'\t\t\t\t// '\n+'&#0*47;?|&#[xX]0*2[fF];?|&sol;'\t\t\t// /\n+'&#0*44;?|&#[xX]0*2[cC];?|&comma;'\t\t\t// ,\n+'&#0*43;?|&#[xX]0*2[bB];?|&plus;'\t\t\t// +\n+'&#0*37;?|&#[xX]0*25;?|&percnt;'\t\t\t// percentage\n+'&#0*35;?|&#[xX]0*23;?|&num;'\t\t\t\t// hash\n+'&#0*33;?|&#[xX]0*21;?|&excl;'\t\t \t\t// !\n+'&#0*42;?|&#[xX]0*2[aA];?|&ast;|&midast;'\t\t// *\n+'&#0*32;?|&#[xX]0*20;?|&#0*9;?|&#[xX]0*9;?|&Tab;|&#0*10;?|&#[xX]0*[aA];?|&NewLine;|&#0*12;?|&#[xX]0*[cC];?|&#0*13;?|&#[xX]0*[dD];?|\\t|\\r|\\n|\\f'; // space,\\t,\\r,\\n,\\f\n+\n+// no need to consider the char below as our parser will complain parse error.\n+'&#0*64;?|&#[xX]0*40;?|&commat;'\t\t \t// @\n+'&#0*46;?|&#[xX]0*2[eE];?|&period;'\t\t \t// .\n+'&#0*123;?|&#[xX]0*7[bB];?|&lcub;|&lbrace;'\t        // {\n+'&#0*125;?|&#[xX]0*7[dD];?|&rcub;|&rbrace;'\t        // }\n+*/\n+\n+CSSParserUtils.reHtmlDecode = /(&bsol;|&lowbar;|&UnderBar;|&colon;|&semi;|&lpar;|&rpar;|&quot;|&QUOT;|&apos;|&sol;|&comma;|&plus;|&percnt;|&num;|&excl;|&ast;|&midast;|&Tab;|&NewLine;|\\t|\\r|\\n|\\f)/g;\n+CSSParserUtils.HtmlDecodeReplacement = {\n+    '&bsol;'     : '\\\\',\n+    '&lowbar;'   : '_', '&UnderBar;' : '_',\n+    '&colon;'    : ':',\n+    '&semi;'     : ';',\n+    '&lpar;'     : '(',\n+    '&rpar;'     : ')',\n+    '&quot;'     : '\"', '&QUOT;'     : '\"',\n+    '&apos;'     : '\\'',\n+    '&sol;'      : '\\/',\n+    '&comma;'    : ',',\n+    '&plus;'     : '+',\n+    '&percnt;'   : '%',\n+    '&num;'      : '#',\n+    '&excl;'     : '!',\n+    '&ast;'      : '*', '&midast;'   : '*',\n+    '&Tab;'      : ' ', '&NewLine;'  : ' ', '\\t'         : ' ', '\\r'         : ' ', '\\n'         : ' ', '\\f'         : ' ',\n+};\n+\n+/* emum type of parseStyleAttributeValue */\n+CSSParserUtils.STYLE_ATTRIBUTE_URL_UNQUOTED      = 1;\n+CSSParserUtils.STYLE_ATTRIBUTE_URL_SINGLE_QUOTED = 2;\n+CSSParserUtils.STYLE_ATTRIBUTE_URL_DOUBLE_QUOTED = 3;\n+CSSParserUtils.STYLE_ATTRIBUTE_UNQUOTED          = 4;\n+CSSParserUtils.STYLE_ATTRIBUTE_SINGLE_QUOTED     = 5;\n+CSSParserUtils.STYLE_ATTRIBUTE_DOUBLE_QUOTED     = 6;\n+\n+CSSParserUtils.STYLE_ATTRIBUTE_ERROR                     = -1;\n+CSSParserUtils.SEMICOLON                                 = -2;\n+\n+/**\n+* @function CSSParserUtils.htmlStyleAttributeValueEntitiesDecode\n+*\n+* @description\n+* The purpose of these functions are to decode the html entities that will affect\n+* the CSS parsing. Basically, any numeric and named character reference representing\n+* the delimiter in the CSS grammer needs to be decoded.\n+*\n+* For example, semicolon represents a delimiter in CSS grammar, so we need to decode it,\n+* however, &gt; is not a delimitor, so we can keep it intact without affecting the CSS\n+* parsing in the downstream. Please be noted that &gt; itself will cause parsing error\n+* no matter decode or not if it does not belong to the STRING token.\n+*\n+* These function decode more than we need to prevent CSS parsing error.\n+*\n+* Reference:\n+* http://www.w3.org/TR/css-style-attr/\n+*\n+*/\n+CSSParserUtils.reCharReferenceDecode = /&([a-z]{2,};?)|&#0*(x[a-f0-9]+|[0-9]+);?/ig;\n+CSSParserUtils.htmlStyleAttributeValueEntitiesDecode = function(str) {","path":"src/css-utils.js","position":99,"original_position":99,"commit_id":"11902ccc9ae8ab66b371cd05054048f3b52c33f9","original_commit_id":"11902ccc9ae8ab66b371cd05054048f3b52c33f9","user":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"body":"TODO: using client browser for html decode will be added in next PR.","created_at":"2015-05-14T09:22:04Z","updated_at":"2015-05-14T09:22:04Z","html_url":"https://github.com/yahoo/secure-handlebars/pull/47#discussion_r30307954","pull_request_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments/30307954"},"html":{"href":"https://github.com/yahoo/secure-handlebars/pull/47#discussion_r30307954"},"pull_request":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47","id":35106251,"html_url":"https://github.com/yahoo/secure-handlebars/pull/47","diff_url":"https://github.com/yahoo/secure-handlebars/pull/47.diff","patch_url":"https://github.com/yahoo/secure-handlebars/pull/47.patch","issue_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/47","number":47,"state":"open","locked":false,"title":"new implementation of style attribute css parsing","user":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"body":"this implementation includes the following\r\n1) using the jison to create the parser for parsing the style attribute\r\n2) coding a html decoding logic for delimiter that will affect CSS parsing\r\n3) all related unit test cases.","created_at":"2015-05-11T08:22:17Z","updated_at":"2015-05-14T09:22:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"33d20d3e6b614aa97f7dc72ed7b6f2c6bf0a432e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47/commits","review_comments_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47/comments","review_comment_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/47/comments","statuses_url":"https://api.github.com/repos/yahoo/secure-handlebars/statuses/11902ccc9ae8ab66b371cd05054048f3b52c33f9","head":{"label":"neraliu:css-style-attr-value","ref":"css-style-attr-value","sha":"11902ccc9ae8ab66b371cd05054048f3b52c33f9","user":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"repo":{"id":33704534,"name":"secure-handlebars","full_name":"neraliu/secure-handlebars","owner":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neraliu/secure-handlebars","description":"Handlebars Context Pre-compiler","fork":true,"url":"https://api.github.com/repos/neraliu/secure-handlebars","forks_url":"https://api.github.com/repos/neraliu/secure-handlebars/forks","keys_url":"https://api.github.com/repos/neraliu/secure-handlebars/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neraliu/secure-handlebars/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neraliu/secure-handlebars/teams","hooks_url":"https://api.github.com/repos/neraliu/secure-handlebars/hooks","issue_events_url":"https://api.github.com/repos/neraliu/secure-handlebars/issues/events{/number}","events_url":"https://api.github.com/repos/neraliu/secure-handlebars/events","assignees_url":"https://api.github.com/repos/neraliu/secure-handlebars/assignees{/user}","branches_url":"https://api.github.com/repos/neraliu/secure-handlebars/branches{/branch}","tags_url":"https://api.github.com/repos/neraliu/secure-handlebars/tags","blobs_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/refs{/sha}","trees_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neraliu/secure-handlebars/statuses/{sha}","languages_url":"https://api.github.com/repos/neraliu/secure-handlebars/languages","stargazers_url":"https://api.github.com/repos/neraliu/secure-handlebars/stargazers","contributors_url":"https://api.github.com/repos/neraliu/secure-handlebars/contributors","subscribers_url":"https://api.github.com/repos/neraliu/secure-handlebars/subscribers","subscription_url":"https://api.github.com/repos/neraliu/secure-handlebars/subscription","commits_url":"https://api.github.com/repos/neraliu/secure-handlebars/commits{/sha}","git_commits_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/commits{/sha}","comments_url":"https://api.github.com/repos/neraliu/secure-handlebars/comments{/number}","issue_comment_url":"https://api.github.com/repos/neraliu/secure-handlebars/issues/comments{/number}","contents_url":"https://api.github.com/repos/neraliu/secure-handlebars/contents/{+path}","compare_url":"https://api.github.com/repos/neraliu/secure-handlebars/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neraliu/secure-handlebars/merges","archive_url":"https://api.github.com/repos/neraliu/secure-handlebars/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neraliu/secure-handlebars/downloads","issues_url":"https://api.github.com/repos/neraliu/secure-handlebars/issues{/number}","pulls_url":"https://api.github.com/repos/neraliu/secure-handlebars/pulls{/number}","milestones_url":"https://api.github.com/repos/neraliu/secure-handlebars/milestones{/number}","notifications_url":"https://api.github.com/repos/neraliu/secure-handlebars/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neraliu/secure-handlebars/labels{/name}","releases_url":"https://api.github.com/repos/neraliu/secure-handlebars/releases{/id}","created_at":"2015-04-10T02:43:29Z","updated_at":"2015-05-08T07:45:06Z","pushed_at":"2015-05-14T09:13:55Z","git_url":"git://github.com/neraliu/secure-handlebars.git","ssh_url":"git@github.com:neraliu/secure-handlebars.git","clone_url":"https://github.com/neraliu/secure-handlebars.git","svn_url":"https://github.com/neraliu/secure-handlebars","homepage":"","size":2081,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yahoo:master","ref":"master","sha":"1a111a0764cf1f9cd027b8cdbc52f814bcfb3213","user":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"repo":{"id":30554349,"name":"secure-handlebars","full_name":"yahoo/secure-handlebars","owner":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yahoo/secure-handlebars","description":"Handlebars Context Pre-compiler","fork":false,"url":"https://api.github.com/repos/yahoo/secure-handlebars","forks_url":"https://api.github.com/repos/yahoo/secure-handlebars/forks","keys_url":"https://api.github.com/repos/yahoo/secure-handlebars/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yahoo/secure-handlebars/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yahoo/secure-handlebars/teams","hooks_url":"https://api.github.com/repos/yahoo/secure-handlebars/hooks","issue_events_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/events{/number}","events_url":"https://api.github.com/repos/yahoo/secure-handlebars/events","assignees_url":"https://api.github.com/repos/yahoo/secure-handlebars/assignees{/user}","branches_url":"https://api.github.com/repos/yahoo/secure-handlebars/branches{/branch}","tags_url":"https://api.github.com/repos/yahoo/secure-handlebars/tags","blobs_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/refs{/sha}","trees_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yahoo/secure-handlebars/statuses/{sha}","languages_url":"https://api.github.com/repos/yahoo/secure-handlebars/languages","stargazers_url":"https://api.github.com/repos/yahoo/secure-handlebars/stargazers","contributors_url":"https://api.github.com/repos/yahoo/secure-handlebars/contributors","subscribers_url":"https://api.github.com/repos/yahoo/secure-handlebars/subscribers","subscription_url":"https://api.github.com/repos/yahoo/secure-handlebars/subscription","commits_url":"https://api.github.com/repos/yahoo/secure-handlebars/commits{/sha}","git_commits_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/commits{/sha}","comments_url":"https://api.github.com/repos/yahoo/secure-handlebars/comments{/number}","issue_comment_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/comments{/number}","contents_url":"https://api.github.com/repos/yahoo/secure-handlebars/contents/{+path}","compare_url":"https://api.github.com/repos/yahoo/secure-handlebars/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yahoo/secure-handlebars/merges","archive_url":"https://api.github.com/repos/yahoo/secure-handlebars/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yahoo/secure-handlebars/downloads","issues_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues{/number}","pulls_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls{/number}","milestones_url":"https://api.github.com/repos/yahoo/secure-handlebars/milestones{/number}","notifications_url":"https://api.github.com/repos/yahoo/secure-handlebars/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yahoo/secure-handlebars/labels{/name}","releases_url":"https://api.github.com/repos/yahoo/secure-handlebars/releases{/id}","created_at":"2015-02-09T19:35:28Z","updated_at":"2015-05-08T06:07:23Z","pushed_at":"2015-05-14T09:13:56Z","git_url":"git://github.com/yahoo/secure-handlebars.git","ssh_url":"git@github.com:yahoo/secure-handlebars.git","clone_url":"https://github.com/yahoo/secure-handlebars.git","svn_url":"https://github.com/yahoo/secure-handlebars","homepage":"","size":2508,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47"},"html":{"href":"https://github.com/yahoo/secure-handlebars/pull/47"},"issue":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/issues/47"},"comments":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/statuses/11902ccc9ae8ab66b371cd05054048f3b52c33f9"}}}}