Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4037112
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:18:25+00:00 2026-05-20T12:18:25+00:00

I’m trying to inline SVG in a HTML4 doc. I was suggested that there

  • 0

I’m trying to inline SVG in a HTML4 doc. I was suggested that there might be some problem since HTML4 does not support inline SVG, so I should do it in XHTML instead.

Interestingly, although supporting inline SVG is not part of HTML4 standard, browsers using WebKit should be happy with inline SVG because its parser is capable of parsing HTML5, which duly supports inline SVG. Unfortunately, Firefox is not in the same league.

However, it’ll be fine for FF as well if I use JavaScript to append a SVG node to a container in the runtime(see below. I got this idea from jquery svg, a plug-in for jquery). Why is it ok to do so? It just seems to me too good to be true.
(I’m a complete novice in JavaScript programming and probably missing something very obvious……)

function onloadSVG(div_container) {
    var svgE = document.createElementNS('http://www.w3.org/2000/svg',
        'svg');
    svgE.setAttribute('version', '1.1');
    svgE.setAttribute('width', div_container.clientWidth);
    svgE.setAttribute('height', div_container.clientHeight);
    div_container.appendChild(svgE);

    var node = svgE.ownerDocument.createElementNS('http://www.w3.org/2000/svg',
        'circle');
    node.setAttribute('cx', '100');
    node.setAttribute('cy', '100');
    node.setAttribute('r', '50');
    node.setAttribute('fill', 'red');
    node.setAttribute('stroke', 'black');
    node.setAttribute('stroke-width', '5');
    svgE.appendChild(node);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T12:18:25+00:00Added an answer on May 20, 2026 at 12:18 pm

    Couple of reasons:

    HTML4 and DOM are not exactly the same thing.

    HTML is just a way of saying what DOM nodes need to be created, but DOM can do much more than that. It’s like unzipping files to a filesystem. Your filesystem can support symlinks, hardlinks, fifos, permissions and all the fancy stuff that ZIP can’t.

    Even without SVG you can create DOM that has no HTML syntax. You can nest <optgroup>, put <ol> in <p>, insert text into <br></br>, etc.

    Browsers (with exception of IE) have just one engine

    It takes extra effort to disable things that browsers support, but weren’t required back when some spec was written. Browsers will support CSS and <table> when given HTML 3.2. They will support <font> even in HTML4 Strict.

    Browsers only special-case some behaviors of quirks mode and application/xhtml+xml mode, which are minimum required for compatibility/conformance. Since lack of support SVG in HTML DOM is not required for compatibility nor conformance, there’s no point spending time on disabling it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.