Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

SVG namespaced documents should create HTML elements

#80

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

Reported by Juan J. Collas · December 8th, 2009 @ 08:51 AM

State: resolved
Milestone: 1.2.x
Assigned to: Thatcher Thatcher

Activity

  1. Juan J. Collas
    Juan J. Collas

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

    December 8th, 2009 @ 08:54 AM

  2. Thatcher
    Thatcher
    • 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

    February 3rd, 2010 @ 05:38 PM

  3. Thatcher
    Thatcher
    • 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.

    February 6th, 2010 @ 05:18 PM

  4. Thatcher
    Thatcher

    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.

    February 6th, 2010 @ 05:20 PM

  5. John Firebaugh
    John Firebaugh

    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.

    April 16th, 2010 @ 01:44 PM

  6. Steven Parkes
    Steven Parkes

    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?

    April 17th, 2010 @ 05:01 AM

  7. John Firebaugh
    John Firebaugh

    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.

    May 25th, 2010 @ 10:51 AM

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.