Skip to main content

Bug Tracker

Side navigation

#11166 closed bug (wontfix)

Opened January 12, 2012 12:45PM UTC

Closed October 08, 2012 04:10PM UTC

Last modified August 01, 2014 06:18AM UTC

attr("viewBox") broken by case folding

Reported by: norman.pellet@gmail.com 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 ?

http://jsfiddle.net/HTZ9n/6/

I think there is an issue while retrieving the viewBox attribute with inline svg.

Do I make any sense ?

Thanks !

Attachments (0)
Change History (12)

Changed January 12, 2012 12:48PM UTC by anonymous comment:1

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

Changed January 12, 2012 03:35PM UTC by timmywil comment:2

component: unfiledattributes
owner: → timmywil
priority: undecidedlow
status: newassigned

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

Changed March 24, 2012 11:32AM UTC by anonymous comment:3

Is this perhaps down to the issue described here? http://api.jquery.com/prop/

The element seems retrievable with .prop, but not with .attr.

Changed July 14, 2012 03:17AM UTC by dmethvin comment:4

summary: attr("viewBox") doesn't workattr("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 ) {

Changed July 23, 2012 04:35PM UTC by timmywil comment:5

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.

Changed October 08, 2012 04:10PM UTC by mikesherov comment:6

resolution: → wontfix
status: assignedclosed

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!

http://docs.jquery.com/Won't_Fix#SVG.2FXML.2FVML_Bugs

Changed January 12, 2014 11:29AM UTC by anonymous comment:7

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.

Changed January 12, 2014 08:40PM UTC by markelog comment:8

Replying to [comment:7 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.

Sorry – http://contribute.jquery.org/wont-fix/

Changed January 14, 2014 09:38AM UTC by anonymous comment:9

Ah, so that's where the documentation went. OK, so could this be set as "patchwelcome" and made a blocker of #7584?

Changed January 14, 2014 06:19PM UTC by markelog comment:10

Replying to [comment:9 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.

Changed July 31, 2014 08:52PM UTC by gibson042 comment:11

#15200 is a duplicate of this ticket.

Changed August 01, 2014 06:18AM UTC by Genosse comment:12

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?