Bug Tracker

Ticket #13092 (closed bug: wontfix)

Opened 20 months ago

Last modified 9 months ago

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

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

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/

Change History

comment:1 Changed 20 months ago by dmethvin

  • Owner set to philip.peitsch@…
  • Status changed from new to pending

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

comment:2 Changed 20 months ago by philip.peitsch@…

  • Status changed from pending to new

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.

comment:3 Changed 20 months ago by Philip Peitsch <philip.peitsch@…>

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.

comment:4 Changed 20 months ago by mikesherov

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

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

philip.peitsch@…, 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.

comment:6 Changed 20 months ago by peitschie

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'; 
Last edited 20 months ago by peitschie (previous) (diff)

comment:7 Changed 20 months ago by mikesherov

Thanks for documenting that workaround peitschie!

comment:8 Changed 10 months ago by gavenkoa

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

comment:9 Changed 9 months ago by rizwanh@…

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');

}

comment:10 Changed 9 months ago by dmethvin

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

Note: See TracTickets for help on using tickets.