Opened 11 years ago
Closed 11 years ago
#11827 closed enhancement (patchwelcome)
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.
Change History (3)
comment:1 Changed 11 years ago by
Owner: | set to queequac |
---|---|
Status: | new → pending |
comment:2 Changed 11 years ago by
Status: | pending → new |
---|
Thanks for your notes! I will realize your suggested modifications tomorrow evening.
comment:3 Changed 11 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | new → closed |
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.
Thanks for contributing. Please see my notes on the PR.