#80 ✓resolved
Juan J. Collas

SVG namespaced documents should create HTML elements

Reported by Juan J. Collas | December 8th, 2009 @ 08:51 AM | in 1.2.x

For compatibility with existing browsers, creating an element that's using the svg namespace, HTML (not XML) elements should be created:

diff --git a/src/html/document.js b/src/html/document.js
index f8947fa..9e47662 100644
--- a/src/html/document.js +++ b/src/html/document.js @@ -89,6 +89,8 @@ extend(HTMLDocument.prototype, {

         return this.createElement(local);
     }else if ("http://www.w3.org/1999/xhtml" == uri) {
          return this.createElement(local);
  •  }else if ("http://www.w3.org/2000/svg" == uri) {
    
  •       return this.createElement(local);
     } else if ("http://www.w3.org/1998/Math/MathML" == uri) {
       if (!this.mathplayerinitialized) {
           var obj = this.createElement("object");
    

Comments and changes to this ticket

  • Juan J. Collas

    Juan J. Collas December 8th, 2009 @ 08:54 AM

    Oops, formatting wrecked the patch.

    diff --git a/src/html/document.js b/src/html/document.js
    index f8947fa..9e47662 100644
    --- a/src/html/document.js
    +++ b/src/html/document.js
    @@ -89,6 +89,8 @@ __extend__(HTMLDocument.prototype, {
                 return this.createElement(local);
             }else if ("http://www.w3.org/1999/xhtml" == uri) {
                  return this.createElement(local);
    +        }else if ("http://www.w3.org/2000/svg" == uri) {
    +             return this.createElement(local);
             } else if ("http://www.w3.org/1998/Math/MathML" == uri) {
               if (!this.mathplayerinitialized) {
                   var obj = this.createElement("object");
    
  • Thatcher

    Thatcher February 3rd, 2010 @ 05:38 PM

    • State changed from “new” to “open”
    • Assigned user set to “Thatcher”
    • Milestone set to 1.2.x

    Can you supply a thorough test case? I will also but shouldn't it depend on if the document type is xhtml or html? I'm not sure, but I have found Envjs to be a great bridge for svg development in the past so I'd really like to focus on it as feature.

    Thanks for the ticket, I'll dig deep and report back soon.

    Thatcher

  • Thatcher

    Thatcher February 6th, 2010 @ 05:18 PM

    • State changed from “open” to “resolved”

    ok I explored this and think I'm on the same page. fortunately the patch was applied awhile ago. it may be a couple weeks before we get good coverage in the spec tests for xml embedded in html but for now we have what I hope you'll agree is a lowest common denomitator.

  • Thatcher

    Thatcher February 6th, 2010 @ 05:20 PM

    ps i removed the mathml stuff too, the other code was actually nonsensical and was a monkey-patch (you can blame me) that came from integration with the html parser.

  • John Firebaugh

    John Firebaugh April 16th, 2010 @ 01:44 PM

    I'm not seeing the above patch in master, and SVG elements aren't created as HTML elements. It seems this ticket should be reopened.

  • Steven Parkes

    Steven Parkes April 17th, 2010 @ 05:01 AM

    I have a little code for this in my branch but haven't looked at how it compares to 1.2.

    What I'm curious about, though, is what people think the expected outcome is here. Maybe I'm missing something important, but I don't think these should be created as HTML elements. They need to be SVG elements. That's what I see Chrome and FireFox doing. My code does createElementNS's and the result is in the svg namespace. Are people expecting something other than that?

  • John Firebaugh

    John Firebaugh May 25th, 2010 @ 10:51 AM

    I think the issue is that SVG elements in Chrome and Firefox inherit from (or at least duck-type as) HTMLElements -- they have all of the HTMLElement methods, whereas in env.js they don't at present.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

Tags

Pages