createElementNS、setAttribute()、SVG 的 viewBox 属性、“
createElementNS document.createElementNS(namespaceURL, tagName) namespaceURL(命名空间 URL) 这是一个固定的字符串,用来告诉浏览器这个标签属于哪个规范。 SVG 固定用: ‘http://www.w3.org/2000/svg’ MathML 用: ‘http://www.w3.org/1998/Math/MathML’ tagName(元素名称) 也就是你要创建的标签名称,例如: ‘svg’ ‘circle’ ‘rect’ ‘path’ 示例:在 SVG 命名空间里创建一个 <svg> 标签 document.createElementNS(‘http://www.w3.org/2000/svg’, ‘svg’); setAttribute() setAttribute(name, value) 是 DOM Continue reading createElementNS、setAttribute()、SVG 的 viewBox 属性、“
