{"action":"created","comment":{"url":"https://api.github.com/repos/servo/servo/pulls/comments/92649991","pull_request_review_id":13169064,"id":92649991,"diff_hunk":"@@ -69,11 +71,36 @@ impl ValidityState {\n impl ValidityStateMethods for ValidityState {\n     // https://html.spec.whatwg.org/multipage/#dom-validitystate-valuemissing\n     fn ValueMissing(&self) -> bool {\n+        if self.element.has_attribute(&local_name!(\"required\")) {\n+            let v = self.element.get_string_attribute(&local_name!(\"value\"));\n+            let n = self.element.get_string_attribute(&local_name!(\"name\"));\n+            if v.is_empty() {\n+                println!(\"{} Value missing!\", n);\n+                return true;\n+            }\n+        }\n         false\n     }\n \n     // https://html.spec.whatwg.org/multipage/#dom-validitystate-typemismatch\n     fn TypeMismatch(&self) -> bool {\n+        if self.element.has_attribute(&local_name!(\"type\")) {\n+            let content_type = self.element.get_string_attribute(&local_name!(\"type\"));\n+            let content_value = self.element.get_string_attribute(&local_name!(\"value\"));\n+            let re = match content_type.to_string().as_ref() {\n+                    \"email\" => Regex::new(r\"^\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,3}$\").unwrap(),\n+                    \"url\" => Regex::new(r\"^[a-zA-Z0-9\\-\\.]+\\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU)$\").unwrap(),\n+                    \"date\" => Regex::new(r\"^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$\").unwrap(),\n+                    \"tel\" => Regex::new(r\"^\\d{3}-\\d{2}-\\d{4}$\").unwrap(),","path":"components/script/dom/validitystate.rs","position":33,"original_position":33,"commit_id":"aafbcc29f1163038bd47ae613277d7a1b78f805f","original_commit_id":"aafbcc29f1163038bd47ae613277d7a1b78f805f","user":{"login":"jdm","id":27658,"avatar_url":"https://avatars.githubusercontent.com/u/27658?v=3","gravatar_id":"","url":"https://api.github.com/users/jdm","html_url":"https://github.com/jdm","followers_url":"https://api.github.com/users/jdm/followers","following_url":"https://api.github.com/users/jdm/following{/other_user}","gists_url":"https://api.github.com/users/jdm/gists{/gist_id}","starred_url":"https://api.github.com/users/jdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdm/subscriptions","organizations_url":"https://api.github.com/users/jdm/orgs","repos_url":"https://api.github.com/users/jdm/repos","events_url":"https://api.github.com/users/jdm/events{/privacy}","received_events_url":"https://api.github.com/users/jdm/received_events","type":"User","site_admin":false},"body":"Unfortunately these regexes need to be either much more complex, or much less strict. I lean towards much less strict - URLs can check if there's a period present; emails can check if there's an @; telephone numbers should not contain letters.","created_at":"2016-12-15T16:50:18Z","updated_at":"2016-12-15T16:52:36Z","html_url":"https://github.com/servo/servo/pull/14566#discussion_r92649991","pull_request_url":"https://api.github.com/repos/servo/servo/pulls/14566","_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/comments/92649991"},"html":{"href":"https://github.com/servo/servo/pull/14566#discussion_r92649991"},"pull_request":{"href":"https://api.github.com/repos/servo/servo/pulls/14566"}}},"pull_request":{"url":"https://api.github.com/repos/servo/servo/pulls/14566","id":97708238,"html_url":"https://github.com/servo/servo/pull/14566","diff_url":"https://github.com/servo/servo/pull/14566.diff","patch_url":"https://github.com/servo/servo/pull/14566.patch","issue_url":"https://api.github.com/repos/servo/servo/issues/14566","number":14566,"state":"open","locked":false,"title":"Subsequent step for implementing HTML form validation","user":{"login":"xilaili626","id":13991570,"avatar_url":"https://avatars.githubusercontent.com/u/13991570?v=3","gravatar_id":"","url":"https://api.github.com/users/xilaili626","html_url":"https://github.com/xilaili626","followers_url":"https://api.github.com/users/xilaili626/followers","following_url":"https://api.github.com/users/xilaili626/following{/other_user}","gists_url":"https://api.github.com/users/xilaili626/gists{/gist_id}","starred_url":"https://api.github.com/users/xilaili626/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xilaili626/subscriptions","organizations_url":"https://api.github.com/users/xilaili626/orgs","repos_url":"https://api.github.com/users/xilaili626/repos","events_url":"https://api.github.com/users/xilaili626/events{/privacy}","received_events_url":"https://api.github.com/users/xilaili626/received_events","type":"User","site_admin":false},"body":"<!-- Please describe your changes on the following line: -->\r\nForm validation project. NCSU M1653 student project.\r\n\r\n---\r\n<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->\r\n- [X] `./mach build -d` does not report any errors\r\n- [X] `./mach test-tidy` does not report any errors\r\n- [ ] These changes fix #__ (github issue number if applicable).\r\n\r\n<!-- Either: -->\r\n- [ ] There are tests for these changes OR\r\n- [ ] These changes do not require tests because _____\r\n\r\n<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/servo/servo/14566)\n<!-- Reviewable:end -->\n","created_at":"2016-12-13T08:51:46Z","updated_at":"2016-12-15T16:52:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77799a87f8bbf99413c1f3c7e584fc104e41f495","assignee":{"login":"jdm","id":27658,"avatar_url":"https://avatars.githubusercontent.com/u/27658?v=3","gravatar_id":"","url":"https://api.github.com/users/jdm","html_url":"https://github.com/jdm","followers_url":"https://api.github.com/users/jdm/followers","following_url":"https://api.github.com/users/jdm/following{/other_user}","gists_url":"https://api.github.com/users/jdm/gists{/gist_id}","starred_url":"https://api.github.com/users/jdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdm/subscriptions","organizations_url":"https://api.github.com/users/jdm/orgs","repos_url":"https://api.github.com/users/jdm/repos","events_url":"https://api.github.com/users/jdm/events{/privacy}","received_events_url":"https://api.github.com/users/jdm/received_events","type":"User","site_admin":false},"assignees":[{"login":"jdm","id":27658,"avatar_url":"https://avatars.githubusercontent.com/u/27658?v=3","gravatar_id":"","url":"https://api.github.com/users/jdm","html_url":"https://github.com/jdm","followers_url":"https://api.github.com/users/jdm/followers","following_url":"https://api.github.com/users/jdm/following{/other_user}","gists_url":"https://api.github.com/users/jdm/gists{/gist_id}","starred_url":"https://api.github.com/users/jdm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdm/subscriptions","organizations_url":"https://api.github.com/users/jdm/orgs","repos_url":"https://api.github.com/users/jdm/repos","events_url":"https://api.github.com/users/jdm/events{/privacy}","received_events_url":"https://api.github.com/users/jdm/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/servo/servo/pulls/14566/commits","review_comments_url":"https://api.github.com/repos/servo/servo/pulls/14566/comments","review_comment_url":"https://api.github.com/repos/servo/servo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/servo/servo/issues/14566/comments","statuses_url":"https://api.github.com/repos/servo/servo/statuses/aafbcc29f1163038bd47ae613277d7a1b78f805f","head":{"label":"xilaili626:master","ref":"master","sha":"aafbcc29f1163038bd47ae613277d7a1b78f805f","user":{"login":"xilaili626","id":13991570,"avatar_url":"https://avatars.githubusercontent.com/u/13991570?v=3","gravatar_id":"","url":"https://api.github.com/users/xilaili626","html_url":"https://github.com/xilaili626","followers_url":"https://api.github.com/users/xilaili626/followers","following_url":"https://api.github.com/users/xilaili626/following{/other_user}","gists_url":"https://api.github.com/users/xilaili626/gists{/gist_id}","starred_url":"https://api.github.com/users/xilaili626/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xilaili626/subscriptions","organizations_url":"https://api.github.com/users/xilaili626/orgs","repos_url":"https://api.github.com/users/xilaili626/repos","events_url":"https://api.github.com/users/xilaili626/events{/privacy}","received_events_url":"https://api.github.com/users/xilaili626/received_events","type":"User","site_admin":false},"repo":{"id":76339170,"name":"servo","full_name":"xilaili626/servo","owner":{"login":"xilaili626","id":13991570,"avatar_url":"https://avatars.githubusercontent.com/u/13991570?v=3","gravatar_id":"","url":"https://api.github.com/users/xilaili626","html_url":"https://github.com/xilaili626","followers_url":"https://api.github.com/users/xilaili626/followers","following_url":"https://api.github.com/users/xilaili626/following{/other_user}","gists_url":"https://api.github.com/users/xilaili626/gists{/gist_id}","starred_url":"https://api.github.com/users/xilaili626/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xilaili626/subscriptions","organizations_url":"https://api.github.com/users/xilaili626/orgs","repos_url":"https://api.github.com/users/xilaili626/repos","events_url":"https://api.github.com/users/xilaili626/events{/privacy}","received_events_url":"https://api.github.com/users/xilaili626/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xilaili626/servo","description":"The Servo Browser Engine","fork":true,"url":"https://api.github.com/repos/xilaili626/servo","forks_url":"https://api.github.com/repos/xilaili626/servo/forks","keys_url":"https://api.github.com/repos/xilaili626/servo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xilaili626/servo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xilaili626/servo/teams","hooks_url":"https://api.github.com/repos/xilaili626/servo/hooks","issue_events_url":"https://api.github.com/repos/xilaili626/servo/issues/events{/number}","events_url":"https://api.github.com/repos/xilaili626/servo/events","assignees_url":"https://api.github.com/repos/xilaili626/servo/assignees{/user}","branches_url":"https://api.github.com/repos/xilaili626/servo/branches{/branch}","tags_url":"https://api.github.com/repos/xilaili626/servo/tags","blobs_url":"https://api.github.com/repos/xilaili626/servo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xilaili626/servo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xilaili626/servo/git/refs{/sha}","trees_url":"https://api.github.com/repos/xilaili626/servo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xilaili626/servo/statuses/{sha}","languages_url":"https://api.github.com/repos/xilaili626/servo/languages","stargazers_url":"https://api.github.com/repos/xilaili626/servo/stargazers","contributors_url":"https://api.github.com/repos/xilaili626/servo/contributors","subscribers_url":"https://api.github.com/repos/xilaili626/servo/subscribers","subscription_url":"https://api.github.com/repos/xilaili626/servo/subscription","commits_url":"https://api.github.com/repos/xilaili626/servo/commits{/sha}","git_commits_url":"https://api.github.com/repos/xilaili626/servo/git/commits{/sha}","comments_url":"https://api.github.com/repos/xilaili626/servo/comments{/number}","issue_comment_url":"https://api.github.com/repos/xilaili626/servo/issues/comments{/number}","contents_url":"https://api.github.com/repos/xilaili626/servo/contents/{+path}","compare_url":"https://api.github.com/repos/xilaili626/servo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xilaili626/servo/merges","archive_url":"https://api.github.com/repos/xilaili626/servo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xilaili626/servo/downloads","issues_url":"https://api.github.com/repos/xilaili626/servo/issues{/number}","pulls_url":"https://api.github.com/repos/xilaili626/servo/pulls{/number}","milestones_url":"https://api.github.com/repos/xilaili626/servo/milestones{/number}","notifications_url":"https://api.github.com/repos/xilaili626/servo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xilaili626/servo/labels{/name}","releases_url":"https://api.github.com/repos/xilaili626/servo/releases{/id}","deployments_url":"https://api.github.com/repos/xilaili626/servo/deployments","created_at":"2016-12-13T08:34:49Z","updated_at":"2016-12-12T22:52:02Z","pushed_at":"2016-12-13T08:43:46Z","git_url":"git://github.com/xilaili626/servo.git","ssh_url":"git@github.com:xilaili626/servo.git","clone_url":"https://github.com/xilaili626/servo.git","svn_url":"https://github.com/xilaili626/servo","homepage":"https://servo.org/","size":222612,"stargazers_count":0,"watchers_count":0,"language":null,"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":"servo:master","ref":"master","sha":"debf5e0e7872347d67d9046b72979bcf7d08f9ca","user":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"repo":{"id":3390243,"name":"servo","full_name":"servo/servo","owner":{"login":"servo","id":2566135,"avatar_url":"https://avatars.githubusercontent.com/u/2566135?v=3","gravatar_id":"","url":"https://api.github.com/users/servo","html_url":"https://github.com/servo","followers_url":"https://api.github.com/users/servo/followers","following_url":"https://api.github.com/users/servo/following{/other_user}","gists_url":"https://api.github.com/users/servo/gists{/gist_id}","starred_url":"https://api.github.com/users/servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/servo/subscriptions","organizations_url":"https://api.github.com/users/servo/orgs","repos_url":"https://api.github.com/users/servo/repos","events_url":"https://api.github.com/users/servo/events{/privacy}","received_events_url":"https://api.github.com/users/servo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/servo/servo","description":"The Servo Browser Engine","fork":false,"url":"https://api.github.com/repos/servo/servo","forks_url":"https://api.github.com/repos/servo/servo/forks","keys_url":"https://api.github.com/repos/servo/servo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/servo/servo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/servo/servo/teams","hooks_url":"https://api.github.com/repos/servo/servo/hooks","issue_events_url":"https://api.github.com/repos/servo/servo/issues/events{/number}","events_url":"https://api.github.com/repos/servo/servo/events","assignees_url":"https://api.github.com/repos/servo/servo/assignees{/user}","branches_url":"https://api.github.com/repos/servo/servo/branches{/branch}","tags_url":"https://api.github.com/repos/servo/servo/tags","blobs_url":"https://api.github.com/repos/servo/servo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/servo/servo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/servo/servo/git/refs{/sha}","trees_url":"https://api.github.com/repos/servo/servo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/servo/servo/statuses/{sha}","languages_url":"https://api.github.com/repos/servo/servo/languages","stargazers_url":"https://api.github.com/repos/servo/servo/stargazers","contributors_url":"https://api.github.com/repos/servo/servo/contributors","subscribers_url":"https://api.github.com/repos/servo/servo/subscribers","subscription_url":"https://api.github.com/repos/servo/servo/subscription","commits_url":"https://api.github.com/repos/servo/servo/commits{/sha}","git_commits_url":"https://api.github.com/repos/servo/servo/git/commits{/sha}","comments_url":"https://api.github.com/repos/servo/servo/comments{/number}","issue_comment_url":"https://api.github.com/repos/servo/servo/issues/comments{/number}","contents_url":"https://api.github.com/repos/servo/servo/contents/{+path}","compare_url":"https://api.github.com/repos/servo/servo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/servo/servo/merges","archive_url":"https://api.github.com/repos/servo/servo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/servo/servo/downloads","issues_url":"https://api.github.com/repos/servo/servo/issues{/number}","pulls_url":"https://api.github.com/repos/servo/servo/pulls{/number}","milestones_url":"https://api.github.com/repos/servo/servo/milestones{/number}","notifications_url":"https://api.github.com/repos/servo/servo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/servo/servo/labels{/name}","releases_url":"https://api.github.com/repos/servo/servo/releases{/id}","deployments_url":"https://api.github.com/repos/servo/servo/deployments","created_at":"2012-02-08T19:07:25Z","updated_at":"2016-12-15T10:41:21Z","pushed_at":"2016-12-15T16:34:43Z","git_url":"git://github.com/servo/servo.git","ssh_url":"git@github.com:servo/servo.git","clone_url":"https://github.com/servo/servo.git","svn_url":"https://github.com/servo/servo","homepage":"https://servo.org/","size":275743,"stargazers_count":8415,"watchers_count":8415,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1388,"mirror_url":null,"open_issues_count":1939,"forks":1388,"open_issues":1939,"watchers":8415,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/servo/servo/pulls/14566"},"html":{"href":"https://github.com/servo/servo/pull/14566"},"issue":{"href":"https://api.github.com/repos/servo/servo/issues/14566"},"comments":{"href":"https://api.github.com/repos/servo/servo/issues/14566/comments"},"review_comments":{"href":"https://api.github.com/repos/servo/servo/pulls/14566/comments"},"review_comment":{"href":"https://api.github.com/repos/servo/servo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/servo/servo/pulls/14566/commits"},"statuses":{"href":"https://api.github.com/repos/servo/servo/statuses/aafbcc29f1163038bd47ae613277d7a1b78f805f"}}}}
{"actor":{"display_login":"jdm"}}