Why is jQuery auto lower casing attribute values?

后端 未结 3 654
离开以前
离开以前 2020-12-16 11:04

I am working with an SVG that is directly placed into an HTML file


   Contents...

Using javascript/jQuery I want t

3条回答
  •  鱼传尺愫
    2020-12-16 11:48

    I might depend on your encoding document type. XHTML documents must use lower case for all HTML element and attribute names. I'm not sure about HTML.

    Update 2

    The only solution I could find is to use:

    $("svg")[0].setAttribute("viewBox", "0 0 166 361");
    

    Update

    I can't explain it for any reason, I tested on my own host because JsFiddle always uses XHTML (boo!). In all cases it was lowercase, but it was still an SVG Element in FF, Chrome and IE9 (I don't know if they were valid because I don't know SVG I'm afraid).

    Firefox Example Chrome Example IE Example

提交回复
热议问题