{"action":"created","issue":{"url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/issues/423","labels_url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/issues/423/labels{/name}","comments_url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/issues/423/comments","events_url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/issues/423/events","html_url":"https://github.com/snowplow/snowplow-javascript-tracker/issues/423","id":113280203,"number":423,"title":"nodeName is null error in getFormTrackingManager::getParentFormName()","user":{"login":"andrewk","id":37946,"avatar_url":"https://avatars.githubusercontent.com/u/37946?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewk","html_url":"https://github.com/andrewk","followers_url":"https://api.github.com/users/andrewk/followers","following_url":"https://api.github.com/users/andrewk/following{/other_user}","gists_url":"https://api.github.com/users/andrewk/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewk/subscriptions","organizations_url":"https://api.github.com/users/andrewk/orgs","repos_url":"https://api.github.com/users/andrewk/repos","events_url":"https://api.github.com/users/andrewk/events{/privacy}","received_events_url":"https://api.github.com/users/andrewk/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/labels/Bug","name":"Bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"fblundun","id":5892914,"avatar_url":"https://avatars.githubusercontent.com/u/5892914?v=3","gravatar_id":"","url":"https://api.github.com/users/fblundun","html_url":"https://github.com/fblundun","followers_url":"https://api.github.com/users/fblundun/followers","following_url":"https://api.github.com/users/fblundun/following{/other_user}","gists_url":"https://api.github.com/users/fblundun/gists{/gist_id}","starred_url":"https://api.github.com/users/fblundun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fblundun/subscriptions","organizations_url":"https://api.github.com/users/fblundun/orgs","repos_url":"https://api.github.com/users/fblundun/repos","events_url":"https://api.github.com/users/fblundun/events{/privacy}","received_events_url":"https://api.github.com/users/fblundun/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/milestones/38","html_url":"https://github.com/snowplow/snowplow-javascript-tracker/milestones/Version%202.5.3","labels_url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/milestones/38/labels","id":1355462,"number":38,"title":"Version 2.5.3","description":"","creator":{"login":"fblundun","id":5892914,"avatar_url":"https://avatars.githubusercontent.com/u/5892914?v=3","gravatar_id":"","url":"https://api.github.com/users/fblundun","html_url":"https://github.com/fblundun","followers_url":"https://api.github.com/users/fblundun/followers","following_url":"https://api.github.com/users/fblundun/following{/other_user}","gists_url":"https://api.github.com/users/fblundun/gists{/gist_id}","starred_url":"https://api.github.com/users/fblundun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fblundun/subscriptions","organizations_url":"https://api.github.com/users/fblundun/orgs","repos_url":"https://api.github.com/users/fblundun/repos","events_url":"https://api.github.com/users/fblundun/events{/privacy}","received_events_url":"https://api.github.com/users/fblundun/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":1,"state":"open","created_at":"2015-10-14T14:19:06Z","updated_at":"2015-10-26T03:48:55Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-10-26T03:48:08Z","updated_at":"2015-10-26T03:52:21Z","closed_at":null,"body":"One of the most common errors in the JS logs of our apps using snowplow is `Unable to get property 'nodeName' of undefined or null reference`. We have updated to the latest version and the error continues.\r\n\r\nI believe this error to be caused by [this code](https://github.com/snowplow/snowplow-javascript-tracker/blob/master/src/js/forms.js#L76-L82):\r\n```\r\n\tfunction getParentFormName(elt) {\r\n\t\twhile (elt && elt.nodeName.toUpperCase() !== 'HTML' && elt.nodeName.toUpperCase() !== 'FORM') {\r\n\t\t\telt = elt.parentNode;\r\n\t\t}\r\n\t\tif (elt.nodeName.toUpperCase() === 'FORM') {\r\n\t\t\treturn getFormElementName(elt);\r\n\t\t}\r\n\t}\r\n```\r\n\r\nAt some point `elt` is being assigned to a `Document` or `DocumentFragment` node type, which will return false to the `while` check, but does not have a `parentNode`. The result is that the `if (elt.nodeName.toUpperCase())` call causes a TypeError as the `parentNode` of a Document or DocumentFragment node is null."},"comment":{"url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/issues/comments/151017137","html_url":"https://github.com/snowplow/snowplow-javascript-tracker/issues/423#issuecomment-151017137","issue_url":"https://api.github.com/repos/snowplow/snowplow-javascript-tracker/issues/423","id":151017137,"user":{"login":"alexanderdean","id":200511,"avatar_url":"https://avatars.githubusercontent.com/u/200511?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderdean","html_url":"https://github.com/alexanderdean","followers_url":"https://api.github.com/users/alexanderdean/followers","following_url":"https://api.github.com/users/alexanderdean/following{/other_user}","gists_url":"https://api.github.com/users/alexanderdean/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderdean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderdean/subscriptions","organizations_url":"https://api.github.com/users/alexanderdean/orgs","repos_url":"https://api.github.com/users/alexanderdean/repos","events_url":"https://api.github.com/users/alexanderdean/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderdean/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T03:52:21Z","updated_at":"2015-10-26T03:52:21Z","body":"Thanks for the detailed bug report!"}}