Skip to main content

Bug Tracker

Side navigation

#11827 closed enhancement (patchwelcome)

Opened May 28, 2012 07:22PM UTC

Closed June 12, 2012 02:47PM UTC

jQuery.clean does not support svg elements

Reported by: queequac Owned by: queequac
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

jQuery.clean allows conversion of strings to DOM nodes.

While working with svg snippets and templates, I realized that svg nodes (e.g. rects) were added to the DOM tree, but not rendered.

It appeared that the created nodes were invalid elements.

See fiddle for illustration: http://jsfiddle.net/RBHB5/

jQuery.clean creates wrapper elements for tr, td, thead and some more and peels them off afterwards.

SVG elements do also require a wrapper (this is: <svg xmlns="http://www.w3.org/2000/svg"></svg>) for correct instantiation by the browser.

Suggested Solution:

Because svg consists of several elements, creating this wrapper for elements with corresponding namespace only would be a sufficent solution instead of adding each single svg element to the existing wrap map. (Further namespaces could be mapped to wrapper elements in the future.)

Since it is recommended to use the namespace for svg elements when being used directly in html, this seems to be a good compromise.

Pull request with the fix as well as related unit test will be made after this ticket is created.

Attachments (0)
Change History (3)

Changed May 28, 2012 08:05PM UTC by rwaldron comment:1

owner: → queequac
status: newpending

Thanks for contributing. Please see my notes on the PR.

Changed May 28, 2012 08:28PM UTC by queequac comment:2

status: pendingnew

Thanks for your notes!

I will realize your suggested modifications tomorrow evening.

Changed June 12, 2012 02:47PM UTC by dmethvin comment:3

resolution: → patchwelcome
status: newclosed

I'll close this and note that SVG is on our wontfix list, but if there is a small patch (and tests) to solve the problem we'd consider it.