The following questions are confusing me. I know they are related, but...
- Is HTML 5 namespace aware (for including tags of SVG/other XML dialects)?
- If it is not, then what about this -
I have read this old link, but I am totally confused... because Mozilla says "to dynamically modify inline SVG, scripting needs to be done this way" - so finally, how can I dynamically modify inline SVG (if HTML 5 is not namespace aware)?
- Or the page needs to be served as (X)HTML 5?
Details -
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hello-SVG</title>
</head>
<body>
<svg width="200" height="200">
<rect x="0" y="0" width="100" height="100" fill="blue"></rect>
</svg>
</body>
</html>
The above code is the correct way to render a rect
(using SVG) in HTML 5. Now, to modify the SVG using JavaScript, Mozilla recommends using this API. And my question is, what is the point of doing so if HTML 5 is not namespace aware? For such cases do browsers automatically switch to (X)HTML 5?
I read this comment on SO, and I find it closest to the answer I'm looking for -
I guess the HTML 5 SVG situation is basically "SVG without a namespace gets the namespace added during parsing (but after that it's just like (X)HTML before)".