Skip to main content

Bug Tracker

Side navigation

#13092 closed bug (wontfix)

Opened December 19, 2012 11:35PM UTC

Closed December 20, 2012 12:42AM UTC

Last modified November 21, 2013 04:34PM UTC

vendorPropName (used by jQuery.css) crashes when used on a namespaced element

Reported by: philip.peitsch@gmail.com Owned by: philip.peitsch@gmail.com
Priority: undecided Milestone: None
Component: unfiled Version: git
Keywords: Cc:
Blocked by: Blocking:
Description

I'm using jQuery in conjuction with webODF, which involves working with namespaced elements. jQuery.css() crashes due to the style element being undefined.

If I manually create a non-namespaced element, jQuery.css() works as expected.

Demonstration code: http://jsbin.com/acuxuc/1/

Attachments (0)
Change History (10)

Changed December 19, 2012 11:44PM UTC by dmethvin comment:1

owner: → philip.peitsch@gmail.com
status: newpending

jQuery hasn't ever worked with namespaces. Many web APIs such as querySelectorAll don't support namespaces. Is this something that broke recently?

Changed December 19, 2012 11:49PM UTC by philip.peitsch@gmail.com comment:2

status: pendingnew

Not a recent breakage as far as I'm aware.

Apart from this crash, all other operations I'm using are working correctly. If I put in the necessary "if(!style) return name;" in the vendorPropName method it appears to work for my needs.

Changed December 20, 2012 12:00AM UTC by Philip Peitsch <philip.peitsch@gmail.com> comment:3

I have confirmed this behaviour is identical in the most recent versions of Chrome and Firefox. Not sure if that is useful for you to know or not however.

Changed December 20, 2012 12:42AM UTC by mikesherov comment:4

resolution: → wontfix
status: newclosed

@dmethvin, we should add namespaced elements to the won't fix list along with VML,SVG, and XML.

philip.peitsch@gmail.com, thanks for contributing, but unfortunately, this isn't something we're going to fix considering it's edge-casiness and the fact that jQuery isn't intended to work on these elements as they aren't part of HTML.

Changed December 20, 2012 12:45AM UTC by mikesherov comment:5

Changed December 20, 2012 03:44AM UTC by peitschie comment:6

_comment0: Fortunately, I was able to work around the issue in this case by specifically overriding the cssProps collection for the specific properties used when attempting to locate the position of a given namespaced element. \ \ I'm just recording this here for anyone hitting a problem like this, as potentially a similar workaround might be employed. The following is added to javascript loaded by the affected page: \ \ jQuery.cssProps['position'] = 'position'; \ jQuery.cssProps['borderTopWidth'] = 'borderTopWidth'; \ jQuery.cssProps['borderLeftWidth'] = 'borderLeftWidth';1355975513709394

Fortunately, I was able to work around the issue in this case by specifically overriding the cssProps collection for the specific properties used when attempting to locate the position of a given namespaced element.

I'm just recording this here for anyone hitting a problem like this, as potentially a similar workaround might be employed. The following is added to javascript loaded by the affected page:

jQuery.cssProps['position'] = 'position';
jQuery.cssProps['borderTopWidth'] = 'borderTopWidth';
jQuery.cssProps['borderLeftWidth'] = 'borderLeftWidth'; 

Changed December 20, 2012 09:37AM UTC by mikesherov comment:7

Thanks for documenting that workaround peitschie!

Changed October 30, 2013 04:14PM UTC by gavenkoa comment:8

FYI this page still live: http://contribute.jquery.org/wont-fix/ (support issues with SVG/VML/etc).

Changed November 21, 2013 04:24PM UTC by rizwanh@stream.com comment:9

Has this been fixed, I am getting same issue on this code

if (ts != top) {

$('#site').contents().animate({ scrollTop: 0 }, 'slow');

}

if (ls != left) {

$('#site').contents().animate({ scrollLeft: 50 }, 'slow');

}

Changed November 21, 2013 04:34PM UTC by dmethvin comment:10

@rizwanh, the discussion above your post should answer the question. If not, ask for help on a forum.