{"action":"created","issue":{"url":"https://api.github.com/repos/openstyles/stylus/issues/252","repository_url":"https://api.github.com/repos/openstyles/stylus","labels_url":"https://api.github.com/repos/openstyles/stylus/issues/252/labels{/name}","comments_url":"https://api.github.com/repos/openstyles/stylus/issues/252/comments","events_url":"https://api.github.com/repos/openstyles/stylus/issues/252/events","html_url":"https://github.com/openstyles/stylus/issues/252","id":275419331,"number":252,"title":"Inject styles in the head","user":{"login":"yurikhan","id":238691,"avatar_url":"https://avatars0.githubusercontent.com/u/238691?v=4","gravatar_id":"","url":"https://api.github.com/users/yurikhan","html_url":"https://github.com/yurikhan","followers_url":"https://api.github.com/users/yurikhan/followers","following_url":"https://api.github.com/users/yurikhan/following{/other_user}","gists_url":"https://api.github.com/users/yurikhan/gists{/gist_id}","starred_url":"https://api.github.com/users/yurikhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurikhan/subscriptions","organizations_url":"https://api.github.com/users/yurikhan/orgs","repos_url":"https://api.github.com/users/yurikhan/repos","events_url":"https://api.github.com/users/yurikhan/events{/privacy}","received_events_url":"https://api.github.com/users/yurikhan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-11-20T16:37:04Z","updated_at":"2017-11-20T20:36:19Z","closed_at":null,"author_association":"NONE","body":"* **Browser**: Firefox 59 Nightly but it probably does not matter\r\n* **Operating System**: GNU/Linux but it does not matter\r\n\r\nThere is this webcomic network called Hiveworks. At least some of the comics published there include this script: http://www.thehiveworks.com/jumpbar.js\r\n\r\nIts last line is:\r\n\r\n`window.addEventListener(\"load\",breakbadtoys2,true);`\r\n\r\nwhere the referenced function contains, among other things:\r\n\r\n```\r\n//script kiddies and malware break html standards\r\nvar St = document.getElementsByTagName('style');\r\nfor( var x = 0; St[x]; x++ ) \r\n{\r\n    if(St[x].parentNode!=document.head)\r\n    {\r\n    \r\n\tSt[x].parentNode.removeChild(St[x]);\r\n    }\r\n}\r\n```\r\n\r\nIncidentally, they are right — `style` is only valid under `head`.\r\n\r\nStylus injects user styles after the `body`, which gets them removed by the above script.\r\n\r\nWhat are the consequences of injecting styles at the end of `head`? One is that user style rules with specificity equal to those in the page body will no longer win by position tiebreaker; are there others?"},"comment":{"url":"https://api.github.com/repos/openstyles/stylus/issues/comments/345823456","html_url":"https://github.com/openstyles/stylus/issues/252#issuecomment-345823456","issue_url":"https://api.github.com/repos/openstyles/stylus/issues/252","id":345823456,"user":{"login":"Mottie","id":136959,"avatar_url":"https://avatars2.githubusercontent.com/u/136959?v=4","gravatar_id":"","url":"https://api.github.com/users/Mottie","html_url":"https://github.com/Mottie","followers_url":"https://api.github.com/users/Mottie/followers","following_url":"https://api.github.com/users/Mottie/following{/other_user}","gists_url":"https://api.github.com/users/Mottie/gists{/gist_id}","starred_url":"https://api.github.com/users/Mottie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mottie/subscriptions","organizations_url":"https://api.github.com/users/Mottie/orgs","repos_url":"https://api.github.com/users/Mottie/repos","events_url":"https://api.github.com/users/Mottie/events{/privacy}","received_events_url":"https://api.github.com/users/Mottie/received_events","type":"User","site_admin":false},"created_at":"2017-11-20T20:36:19Z","updated_at":"2017-11-20T20:36:19Z","author_association":"MEMBER","body":"We need control over the css to allow enabling & disabling when the user changes the state in the popup; `insertCSS` doesn't easily allow for this need."}}
{"actor":{"display_login":"Mottie"}}