#11166 closed bug (wontfix)
attr("viewBox") broken by case folding
Reported by: | Owned by: | timmywil | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | attributes | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi !
May I let you take a look at this fiddle ?
I think there is an issue while retrieving the viewBox attribute with inline svg. Do I make any sense ?
Thanks !
Change History (12)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Component: | unfiled → attributes |
---|---|
Owner: | set to timmywil |
Priority: | undecided → low |
Status: | new → assigned |
Confirmed. http://jsfiddle.net/timmywil/HTZ9n/7/show/
The viewBox
attribute should stay camelCase. SVG may be the only exception where attribute names are not lowercase. http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute
comment:3 Changed 10 years ago by
Is this perhaps down to the issue described here? http://api.jquery.com/prop/ The element seems retrievable with .prop, but not with .attr.
comment:4 Changed 10 years ago by
Summary: | attr("viewBox") doesn't work → attr("viewBox") broken by case folding |
---|
It seems like the DOM attribute methods are case insensitive on sane browsers, so perhaps we can just skip the .toLowerCase()
part? In a quick check to .attr()
I just moved the lowercase to getting the attrHook only and got a full pass including IE7 and IE8. I wasn't able to get a full test in IE6 due to some BrowserStack issues.
In environments where there is case sensitivity (including IE7 HTML) I don't think there is any way to hide that, so documenting that the case must match seems fine to me.
--- a/src/attributes.js +++ b/src/attributes.js @@ -305,8 +305,7 @@ jQuery.extend({ // All attributes are lowercase // Grab necessary hook if one is defined if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + hooks = jQuery.attrHooks[ name.toLowerCase() ] || ( rboolean.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) {
comment:5 Changed 10 years ago by
Attributes are not case sensitive in IE when using getAttributeNode, which we use for all html attributes in IE. viewBox is technically an svg attribute that should be rendered with xhtml or xml, which is why it is case-sensitive. I think the best solution would be to have a test for svg, if possible.
comment:6 Changed 10 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Unfortunately, we don't support SVG, and even though this worked in the past, it's not something we're supporting so we're not going to fix it for now. If we decide to support SVG in the future, we'll reopen and address this issue.
Thanks!
comment:7 follow-up: 8 Changed 8 years ago by
Requesting that this be re-opened. jQuery 2.x is advertised as supporting modern browsers, all of which support SVG, so fixing it in at least 2.x would be valuable. Also, there is currently no official documentation stating it won't be fixed, as the page for that on docs.jquery.com is gone.
comment:8 Changed 8 years ago by
Replying to anonymous:
Requesting that this be re-opened. jQuery 2.x is advertised as supporting modern browsers, all of which support SVG, so fixing it in at least 2.x would be valuable. Also, there is currently no official documentation stating it won't be fixed, as the page for that on docs.jquery.com is gone.
comment:9 follow-up: 10 Changed 8 years ago by
Ah, so that's where the documentation went. OK, so could this be set as "patchwelcome" and made a blocker of #7584?
comment:10 Changed 8 years ago by
Replying to anonymous:
Ah, so that's where the documentation went. OK, so could this be set as "patchwelcome" and made a blocker of #7584?
At that point of time, it's the other way around - doc will be changed, all svg/vml "patchwelcome" tickets will become "wontfix", but some svg related issues could be addressed, if they would affect wide amount of users.
comment:12 Changed 8 years ago by
Well, What is the reason to convert characters in attributes to lowercase? But for normal basic support SVG need only CamelCase notation. And you do not want to do this thing for many years? Why?
A few more things:
Tested on Firefox 9.0.1, Chrome 17.0.963.33 beta, Safari 5.1.1
worked with jQuery 1.6.4