{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/html/issues/1215","repository_url":"https://api.github.com/repos/whatwg/html","labels_url":"https://api.github.com/repos/whatwg/html/issues/1215/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/html/issues/1215/comments","events_url":"https://api.github.com/repos/whatwg/html/issues/1215/events","html_url":"https://github.com/whatwg/html/issues/1215","id":153635999,"number":1215,"title":"Should U+003C (less-than sign) in SVG script elements be a non-error?","user":{"login":"sideshowbarker","id":194984,"avatar_url":"https://avatars.githubusercontent.com/u/194984?v=3","gravatar_id":"","url":"https://api.github.com/users/sideshowbarker","html_url":"https://github.com/sideshowbarker","followers_url":"https://api.github.com/users/sideshowbarker/followers","following_url":"https://api.github.com/users/sideshowbarker/following{/other_user}","gists_url":"https://api.github.com/users/sideshowbarker/gists{/gist_id}","starred_url":"https://api.github.com/users/sideshowbarker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sideshowbarker/subscriptions","organizations_url":"https://api.github.com/users/sideshowbarker/orgs","repos_url":"https://api.github.com/users/sideshowbarker/repos","events_url":"https://api.github.com/users/sideshowbarker/events{/privacy}","received_events_url":"https://api.github.com/users/sideshowbarker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-08T05:07:58Z","updated_at":"2016-05-08T06:44:58Z","closed_at":null,"body":"As far as I understand, the HTML parsing algorithm currently defines the following as a parse error, due to the presence of the unescaped U+003C (less-than sign) within the SVG `script` element.\r\n\r\n    <svg width='320px' height='320px'>\r\n      <script type='text/javascript'>\r\n        if (1 < 2) a = 0;\r\n      </script>\r\n    </svg>\r\n\r\nI believe the reason that’s a parse error is that per the SVG spec, that U+003C is not allowed in any SVG element—similar to the way U+003C is not allowed in most HTML elements (what the HTML spec calls [“normal elements“](https://html.spec.whatwg.org/multipage/syntax.html#normal-elements)), but instead only in the HTML [“raw text elements”](https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements) `script` and `style` and the HTML [“escapable raw text element”](https://html.spec.whatwg.org/multipage/syntax.html#escapable-raw-text-elements) `textarea` and `title`—and the HTML spec does not classify the SVG `script` element as a “raw text element” covered by special rules in the HTML parsing algorithm\r\n\r\nHowever, given the following:\r\n\r\n* the U+003C character in the SVG `script` element goes into the DOM as expected and browsers execute the content of that SVG `script` element as expected; and\r\n* for the case of an HTML `script` element, the HTML parsing algorithm does not define that U+003C less-than sign as a parse error\r\n\r\n…then maybe we should consider updating the HTML parsing algorithm to require the same specific  [“raw text elements”](https://html.spec.whatwg.org/multipage/syntax.html#raw-text-elements) handling for SVG `script` elements as it does for HTML `script` elements."},"comment":{"url":"https://api.github.com/repos/whatwg/html/issues/comments/217698788","html_url":"https://github.com/whatwg/html/issues/1215#issuecomment-217698788","issue_url":"https://api.github.com/repos/whatwg/html/issues/1215","id":217698788,"user":{"login":"zcorpan","id":244772,"avatar_url":"https://avatars.githubusercontent.com/u/244772?v=3","gravatar_id":"","url":"https://api.github.com/users/zcorpan","html_url":"https://github.com/zcorpan","followers_url":"https://api.github.com/users/zcorpan/followers","following_url":"https://api.github.com/users/zcorpan/following{/other_user}","gists_url":"https://api.github.com/users/zcorpan/gists{/gist_id}","starred_url":"https://api.github.com/users/zcorpan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcorpan/subscriptions","organizations_url":"https://api.github.com/users/zcorpan/orgs","repos_url":"https://api.github.com/users/zcorpan/repos","events_url":"https://api.github.com/users/zcorpan/events{/privacy}","received_events_url":"https://api.github.com/users/zcorpan/received_events","type":"User","site_admin":false},"created_at":"2016-05-08T06:44:58Z","updated_at":"2016-05-08T06:44:58Z","body":"```\r\n<svg width='320px' height='320px'>\r\n  <script type='text/javascript'>\r\n    if (1<foo) a = 0;\r\n  </script>\r\n</svg>\r\n```\r\n..creates an element \"foo)\".\r\n\r\nIt's bad ergonomics, but it's the same as in XML, and the solution is also the same; use `<![CDATA[` ... `]]>`. Maybe you can special-case the message in v.nu for SVG script/style?"}}