Bug Tracker

Modify

Ticket #11166 (closed bug: wontfix)

Opened 2 years ago

Last modified 3 months ago

attr("viewBox") broken by case folding

Reported by: norman.pellet@… Owned by: timmywil
Priority: low Milestone: None
Component: attributes Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

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 !

Change History

comment:1 Changed 2 years ago by anonymous

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

comment:2 Changed 2 years ago by timmywil

  • Owner set to timmywil
  • Priority changed from undecided to low
  • Status changed from new to assigned
  • Component changed from unfiled to attributes

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 2 years ago by anonymous

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 21 months ago by dmethvin

  • Summary changed from attr("viewBox") doesn't work to 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 21 months ago by timmywil

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 19 months ago by mikesherov

  • Status changed from assigned to closed
  • Resolution set to wontfix

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

comment:7 follow-up: ↓ 8 Changed 3 months ago by 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:8 in reply to: ↑ 7 Changed 3 months ago by markelog

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.

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

comment:9 follow-up: ↓ 10 Changed 3 months ago by anonymous

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

comment:10 in reply to: ↑ 9 Changed 3 months ago by markelog

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.